diff --git a/ci-scripts/Jenkinsfile-push-registry b/ci-scripts/Jenkinsfile-push-registry
index f5847ff0aa..bc1a80ba61 100644
--- a/ci-scripts/Jenkinsfile-push-registry
+++ b/ci-scripts/Jenkinsfile-push-registry
@@ -26,6 +26,9 @@ def nodeExecutor = params.nodeExecutor
// Name of the phone resource
def ciServerResource = params.serverResource
+// Docker Hub account to push to
+def DH_Account = "oaisoftwarealliance"
+
pipeline {
agent {
label nodeExecutor
@@ -66,11 +69,11 @@ pipeline {
def listOfImages = ["oai-enb", "oai-gnb", "oai-lte-ue", "oai-nr-ue"]
sh "docker login -u ${DH_Username} -p ${DH_Password} > /dev/null 2>&1"
listOfImages.eachWithIndex { item, iindex ->
- sh "docker image tag ${item}:develop ${DH_Username}/${item}:develop"
- sh "docker image tag ${item}:develop ${DH_Username}/${item}:${WEEK_TAG}"
- sh "docker push --quiet ${DH_Username}/${item}:${WEEK_TAG}"
- sh "docker push --quiet ${DH_Username}/${item}:develop"
- sh "docker rmi ${DH_Username}/${item}:${WEEK_TAG} ${DH_Username}/${item}:develop"
+ sh "docker image tag ${item}:develop ${DH_Account}/${item}:develop"
+ sh "docker image tag ${item}:develop ${DH_Account}/${item}:${WEEK_TAG}"
+ sh "docker push --quiet ${DH_Account}/${item}:${WEEK_TAG}"
+ sh "docker push --quiet ${DH_Account}/${item}:develop"
+ sh "docker rmi ${DH_Account}/${item}:${WEEK_TAG} ${DH_Account}/${item}:develop"
}
sh "docker logout > /dev/null 2>&1"
}
diff --git a/ci-scripts/cls_log_mgt.py b/ci-scripts/cls_log_mgt.py
index e29e9168b7..f1dbf6b8ec 100644
--- a/ci-scripts/cls_log_mgt.py
+++ b/ci-scripts/cls_log_mgt.py
@@ -81,11 +81,11 @@ class Log_Mgt:
def LogRotation(self):
doLoop = True
nbDays = 14
- while doLoop and nbDays > 2:
+ while doLoop and nbDays > 1:
used_space = self.__CheckUsedSpace() #avail space in target folder
if used_space > 80 :
logging.debug('\u001B[1;37;41m Used Disk (' + str(used_space) + '%) > 80%, on ' + self.Username+'@'+self.IPAddress + '\u001B[0m')
- logging.debug('\u001B[1;37;41m Removing Artifacts older than ' + nbDays + ' days \u001B[0m')
+ logging.debug('\u001B[1;37;41m Removing Artifacts older than ' + str(nbDays) + ' days \u001B[0m')
self.__RemoveOldest(nbDays)
nbDays -= 1
else:
diff --git a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf
index e3bd49e7fc..fa7c190538 100644
--- a/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf
+++ b/ci-scripts/conf_files/gnb.band78.nsa_2x2.106PRB.usrpn310.conf
@@ -199,12 +199,12 @@ gNBs =
);
MACRLCs = (
- {
- num_cc = 1;
- tr_s_preference = "local_L1";
- tr_n_preference = "local_RRC";
- ulsch_max_frame_inactivity = 1;
- }
+{
+ num_cc = 1;
+ tr_s_preference = "local_L1";
+ tr_n_preference = "local_RRC";
+ ulsch_max_frame_inactivity = 0;
+}
);
L1s = (
@@ -213,6 +213,7 @@ L1s = (
tr_n_preference = "local_mac";
thread_pool_size = 8;
prach_dtx_threshold = 120;
+ pucch0_dtx_threshold = 80;
}
);
diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf
index af58145322..f3515d3882 100644
--- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf
+++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf
@@ -203,7 +203,7 @@ MACRLCs = (
tr_n_preference = "local_RRC";
pusch_TargetSNRx10 = 200;
pucch_TargetSNRx10 = 200;
- ulsch_max_frame_inactivity = 1;
+ ulsch_max_frame_inactivity = 0;
}
);
@@ -221,11 +221,11 @@ RUs = (
local_rf = "yes"
nb_tx = 1
nb_rx = 1
- att_tx = 3
- att_rx = 0;
+ att_tx = 12
+ att_rx = 12;
bands = [7];
max_pdschReferenceSignalPower = -27;
- max_rxgain = 111;
+ max_rxgain = 114;
eNB_instances = [0];
# sdr_addrs = "serial=30C51D4";
# clock_src = "external";
diff --git a/ci-scripts/provideUniqueImageTag.py b/ci-scripts/provideUniqueImageTag.py
index ee8306402f..88d51ca6f8 100644
--- a/ci-scripts/provideUniqueImageTag.py
+++ b/ci-scripts/provideUniqueImageTag.py
@@ -5,15 +5,15 @@ import subprocess
import sys
AUTH_SERVICE = 'registry.docker.io'
-AUTH_SCOPE = 'repository:rdefosseoai/oai-enb:pull'
+AUTH_SCOPE = 'repository:oaisoftwarealliance/oai-enb:pull'
def main() -> None:
args = _parse_args()
- cmd = 'curl -fsSL "https://auth.docker.io/token?service=' + AUTH_SERVICE + '&scope=' + AUTH_SCOPE + '" | jq --raw-output ".token"'
+ cmd = 'curl -fsSL "https://auth.docker.io/token?service=' + AUTH_SERVICE + '&scope=' + AUTH_SCOPE + '" 2>/dev/null | jq --raw-output ".token"'
token = subprocess.check_output(cmd, shell=True, universal_newlines=True)
token = str(token).strip()
- cmd = 'curl -fsSL -H "Authorization: Bearer ' + token + '" "https://index.docker.io/v2/rdefosseoai/oai-enb/tags/list" | jq .'
+ cmd = 'curl -fsSL -H "Authorization: Bearer ' + token + '" "https://index.docker.io/v2/oaisoftwarealliance/oai-enb/tags/list" 2>/dev/null | jq .'
listOfTags = subprocess.check_output(cmd, shell=True, universal_newlines=True)
foundTag = False
diff --git a/ci-scripts/xml_files/container_nsa_b200_quectel.xml b/ci-scripts/xml_files/container_nsa_b200_quectel.xml
index 610f0b019a..47a939f63c 100644
--- a/ci-scripts/xml_files/container_nsa_b200_quectel.xml
+++ b/ci-scripts/xml_files/container_nsa_b200_quectel.xml
@@ -138,19 +138,19 @@
Iperf
- iperf (DL/40Mbps/UDP)(60 sec)(single-ue profile)
- -u -b 40M -t 60 -i 1 -fm
+ iperf (DL/125Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 125M -t 60 -i 1 -fm
DL
idefix
- 20
- 85
+ 1
+ 95
single-ue
Iperf
- iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)
- -u -b 3M -t 60 -i 1 -fm
+ iperf (UL/8Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 8M -t 60 -i 1 -fm
UL
idefix
1
diff --git a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml
index a4dcb58e8b..2ef2b7d7ce 100644
--- a/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml
+++ b/ci-scripts/xml_files/fr1_nsa_2x2_quectel.xml
@@ -115,11 +115,12 @@
Iperf
- iperf (DL/60Mbps/UDP)(60 sec)(single-ue profile)
- -u -b 60M -t 60
+ iperf (DL/125Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 125M -t 60
DL
nrmodule2_quectel
- 5
+ 15
+ 85
single-ue
diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml
index 55f6f4376e..0f8c90abdf 100644
--- a/ci-scripts/xml_files/fr1_nsa_quectel.xml
+++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml
@@ -74,7 +74,7 @@
Initialize_eNB
Initialize gNB
- -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q --RUs.[0].sdr_addrs "serial=30C51D4" --log_config.global_log_options level,nocolor,time,line_num,function
+ -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q --RUs.[0].sdr_addrs "serial=30C51D4" --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function
1
1
nr
@@ -117,37 +117,37 @@
-u -b 30M -t 30
DL
idefix
- 5
+ 1
95
single-ue
Iperf
- iperf (DL/40Mbps/UDP)(30 sec)(single-ue profile)
- -u -b 40M -t 30
+ iperf (DL/90Mbps/UDP)(30 sec)(single-ue profile)
+ -u -b 90M -t 30
DL
idefix
- 5
+ 1
95
single-ue
Iperf
- iperf (DL/60Mbps/UDP)(60 sec)(single-ue profile)
- -u -b 60M -t 60
+ iperf (DL/125Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 125M -t 60
DL
idefix
- 5
+ 1
95
single-ue
Iperf
- iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)
- -u -b 3M -t 60
+ iperf (UL/8Mbps/UDP)(60 sec)(single-ue profile)
+ -u -b 8M -t 60
UL
idefix
1
diff --git a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md
index be0d63838b..1a947d0389 100644
--- a/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md
+++ b/ci-scripts/yaml_files/4g_rfsimulator_fdd_05MHz/README.md
@@ -31,9 +31,7 @@ This page is only valid for an `Ubuntu18` host.
# 1. Retrieving the images on Docker-Hub #
-Currently the images are hosted under the user account `rdefosseoai`.
-
-This may change in the future.
+Currently the images are hosted under the team account `oaisoftwarealliance`. They were previously hosted under the user account `rdefosseoai`.
Once again you may need to log on [docker-hub](https://hub.docker.com/) if your organization has reached pulling limit as `anonymous`.
@@ -49,13 +47,13 @@ Now pull images.
```bash
$ docker pull cassandra:2.1
$ docker pull redis:6.0.5
-$ docker pull rdefosseoai/oai-hss:latest
-$ docker pull rdefosseoai/magma-mme:latest
-$ docker pull rdefosseoai/oai-spgwc:latest
-$ docker pull rdefosseoai/oai-spgwu-tiny:latest
+$ docker pull oaisoftwarealliance/oai-hss:latest
+$ docker pull oaisoftwarealliance/magma-mme:latest
+$ docker pull oaisoftwarealliance/oai-spgwc:latest
+$ docker pull oaisoftwarealliance/oai-spgwu-tiny:latest
-$ docker pull rdefosseoai/oai-enb:develop
-$ docker pull rdefosseoai/oai-lte-ue:develop
+$ docker pull oaisoftwarealliance/oai-enb:develop
+$ docker pull oaisoftwarealliance/oai-lte-ue:develop
```
If the `redis` tag is not available, pick the newest available `6.0.x` tag at [Docker Hub Redis Tags](https://hub.docker.com/_/redis?tab=tags).
@@ -63,13 +61,13 @@ If the `redis` tag is not available, pick the newest available `6.0.x` tag at [D
And **re-tag** them for tutorials' docker-compose file to work.
```bash
-$ docker image tag rdefosseoai/oai-spgwc:latest oai-spgwc:latest
-$ docker image tag rdefosseoai/oai-hss:latest oai-hss:latest
-$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest
-$ docker image tag rdefosseoai/magma-mme:latest magma-mme:latest
+$ docker image tag oaisoftwarealliance/oai-spgwc:latest oai-spgwc:latest
+$ docker image tag oaisoftwarealliance/oai-hss:latest oai-hss:latest
+$ docker image tag oaisoftwarealliance/oai-spgwu-tiny:latest oai-spgwu-tiny:latest
+$ docker image tag oaisoftwarealliance/magma-mme:latest magma-mme:latest
-$ docker image tag rdefosseoai/oai-enb:develop oai-enb:develop
-$ docker image tag rdefosseoai/oai-lte-ue:develop oai-lte-ue:develop
+$ docker image tag oaisoftwarealliance/oai-enb:develop oai-enb:develop
+$ docker image tag oaisoftwarealliance/oai-lte-ue:develop oai-lte-ue:develop
```
```bash
diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md
index f1e1287995..c3f631cf76 100644
--- a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md
+++ b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md
@@ -18,9 +18,7 @@ This tutorial is only valid once this file is merged into the `develop` branch.
# 1. Retrieving the images on Docker-Hub #
-Currently the images are hosted under the user account `rdefosseoai`.
-
-This may change in the future.
+Currently the images are hosted under the team account `oaisoftwarealliance`. They were previously hosted under the user account `rdefosseoai`.
Once again you may need to log on [docker-hub](https://hub.docker.com/) if your organization has reached pulling limit as `anonymous`.
@@ -35,27 +33,27 @@ Now pull images.
```bash
$ docker pull mysql:5.7
-$ docker pull rdefosseoai/oai-amf:latest
-$ docker pull rdefosseoai/oai-nrf:latest
-$ docker pull rdefosseoai/oai-smf:latest
-$ docker pull rdefosseoai/oai-spgwu-tiny:latest
+$ docker pull oaisoftwarealliance/oai-amf:latest
+$ docker pull oaisoftwarealliance/oai-nrf:latest
+$ docker pull oaisoftwarealliance/oai-smf:latest
+$ docker pull oaisoftwarealliance/oai-spgwu-tiny:latest
-$ docker pull rdefosseoai/oai-gnb:develop
-$ docker pull rdefosseoai/oai-nr-ue:develop
-$ docker pull rdefosseoai/proxy:latest
+$ docker pull oaisoftwarealliance/oai-gnb:develop
+$ docker pull oaisoftwarealliance/oai-nr-ue:develop
+$ docker pull oaisoftwarealliance/proxy:latest
```
And **re-tag** them for tutorials' docker-compose file to work.
```bash
-$ docker image tag rdefosseoai/oai-amf:latest oai-amf:latest
-$ docker image tag rdefosseoai/oai-nrf:latest oai-nrf:latest
-$ docker image tag rdefosseoai/oai-smf:latest oai-smf:latest
-$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest
+$ docker image tag oaisoftwarealliance/oai-amf:latest oai-amf:latest
+$ docker image tag oaisoftwarealliance/oai-nrf:latest oai-nrf:latest
+$ docker image tag oaisoftwarealliance/oai-smf:latest oai-smf:latest
+$ docker image tag oaisoftwarealliance/oai-spgwu-tiny:latest oai-spgwu-tiny:latest
-$ docker image tag rdefosseoai/oai-gnb:develop oai-gnb:develop
-$ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop
-$ docker image tag rdefosseoai/proxy:latest oai-lte-multi-ue-proxy:latest
+$ docker image tag oaisoftwarealliance/oai-gnb:develop oai-gnb:develop
+$ docker image tag oaisoftwarealliance/oai-nr-ue:develop oai-nr-ue:develop
+$ docker image tag oaisoftwarealliance/proxy:latest oai-lte-multi-ue-proxy:latest
```
```bash
diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md
index 64c9084500..aa18571776 100644
--- a/ci-scripts/yaml_files/5g_rfsimulator/README.md
+++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md
@@ -35,9 +35,7 @@ This page is only valid for an `Ubuntu18` host.
# 1. Retrieving the images on Docker-Hub #
-Currently the images are hosted under the user account `rdefosseoai`.
-
-This may change in the future.
+Currently the images are hosted under the team account `oaisoftwarealliance`. They were previously hosted under the user account `rdefosseoai`.
Once again you may need to log on [docker-hub](https://hub.docker.com/) if your organization has reached pulling limit as `anonymous`.
@@ -52,25 +50,25 @@ Now pull images.
```bash
$ docker pull mysql:5.7
-$ docker pull rdefosseoai/oai-amf:latest
-$ docker pull rdefosseoai/oai-nrf:latest
-$ docker pull rdefosseoai/oai-smf:latest
-$ docker pull rdefosseoai/oai-spgwu-tiny:latest
+$ docker pull oaisoftwarealliance/oai-amf:latest
+$ docker pull oaisoftwarealliance/oai-nrf:latest
+$ docker pull oaisoftwarealliance/oai-smf:latest
+$ docker pull oaisoftwarealliance/oai-spgwu-tiny:latest
-$ docker pull rdefosseoai/oai-gnb:develop
-$ docker pull rdefosseoai/oai-nr-ue:develop
+$ docker pull oaisoftwarealliance/oai-gnb:develop
+$ docker pull oaisoftwarealliance/oai-nr-ue:develop
```
And **re-tag** them for tutorials' docker-compose file to work.
```bash
-$ docker image tag rdefosseoai/oai-amf:latest oai-amf:latest
-$ docker image tag rdefosseoai/oai-nrf:latest oai-nrf:latest
-$ docker image tag rdefosseoai/oai-smf:latest oai-smf:latest
-$ docker image tag rdefosseoai/oai-spgwu-tiny:latest oai-spgwu-tiny:latest
+$ docker image tag oaisoftwarealliance/oai-amf:latest oai-amf:latest
+$ docker image tag oaisoftwarealliance/oai-nrf:latest oai-nrf:latest
+$ docker image tag oaisoftwarealliance/oai-smf:latest oai-smf:latest
+$ docker image tag oaisoftwarealliance/oai-spgwu-tiny:latest oai-spgwu-tiny:latest
-$ docker image tag rdefosseoai/oai-gnb:develop oai-gnb:develop
-$ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop
+$ docker image tag oaisoftwarealliance/oai-gnb:develop oai-gnb:develop
+$ docker image tag oaisoftwarealliance/oai-nr-ue:develop oai-nr-ue:develop
```
```bash
diff --git a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml
index 61266aa2b1..208e1564cd 100644
--- a/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml
+++ b/ci-scripts/yaml_files/nsa_b200_gnb/docker-compose.yml
@@ -26,7 +26,7 @@ services:
FLEXRAN_INTERFACE_NAME: eth0
FLEXRAN_IPV4_ADDRESS: 172.21.16.136
THREAD_PARALLEL_CONFIG: PARALLEL_RU_L1_TRX_SPLIT
- USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --log_config.global_log_options level,nocolor,time,line_num,function
+ USE_ADDITIONAL_OPTIONS: -E -q --RUs.[0].sdr_addrs serial=30C51D4 --continuous-tx --log_config.global_log_options level,nocolor,time,line_num,function
volumes:
- /dev:/dev
networks:
diff --git a/cmake_targets/autotests/test_case_list.xml b/cmake_targets/autotests/test_case_list.xml
index ce1b9dcdf4..b55228bdc9 100755
--- a/cmake_targets/autotests/test_case_list.xml
+++ b/cmake_targets/autotests/test_case_list.xml
@@ -1093,7 +1093,7 @@
(Test8: 217 PRB 100 PDSCH-PRBs 110 PDSCH-Offset),
(Test9: 106 PRBs 50 PDSCH-PRBs MCS Index 27),
(Test10: 106 PRBs 50 PDSCH-PRBs MCS Index 16),
- (Test11: 106 MCS-TABLE 256 QAM MCS Index 27),
+ (Test11: 106 MCS-TABLE 256 QAM MCS Index 26),
(Test12: HARQ test 25% TP 4 rounds),
(Test13: HARQ test 33% TP 3 rounds),
(Test14: HARQ test 50% TP 2 rounds),
@@ -1121,7 +1121,7 @@
-n100 -R217 -a110 -s5 -b100
-n100 -e27 -s30
-n100 -e16 -s10
- -n100 -q1 -e27 -s30
+ -n100 -q1 -e26 -s30
-n100 -s1 -t25
-n100 -s1 -t33
-n100 -s1 -t50
diff --git a/cmake_targets/phy_simulators b/cmake_targets/phy_simulators
deleted file mode 120000
index 2a12e92f3e..0000000000
--- a/cmake_targets/phy_simulators
+++ /dev/null
@@ -1 +0,0 @@
-ran_build/
\ No newline at end of file
diff --git a/common/utils/assertions.h b/common/utils/assertions.h
index 573036b1d9..c8959d0adb 100644
--- a/common/utils/assertions.h
+++ b/common/utils/assertions.h
@@ -44,9 +44,9 @@
#define _Assert_(cOND, aCTION, fORMAT, aRGS...) \
do { \
if (!(cOND)) { \
- fprintf(stderr, "\nAssertion ("#cOND") failed!\n" \
+ fprintf(stderr, "\nAssertion (%s) failed!\n" \
"In %s() %s:%d\n" fORMAT, \
- __FUNCTION__, __FILE__, __LINE__, ##aRGS); \
+ #cOND, __FUNCTION__, __FILE__, __LINE__, ##aRGS); \
aCTION; \
} \
} while(0)
diff --git a/common/utils/lte/ue_power.c b/common/utils/lte/ue_power.c
index b377abf2ff..aaa2826275 100644
--- a/common/utils/lte/ue_power.c
+++ b/common/utils/lte/ue_power.c
@@ -33,10 +33,8 @@
#include
#include
#include "PHY/defs_eNB.h"
-#include "PHY/TOOLS/dB_routines.h"
-
-extern int16_t hundred_times_delta_TF[100];
-extern uint16_t hundred_times_log10_NPRB[100];
+#include
+#include
int16_t estimate_ue_tx_power(int norm,uint32_t tbs, uint32_t nb_rb, uint8_t control_only, int ncp, uint8_t use_srs)
{
diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c
index 49743b3bdc..0aeeaf3afd 100644
--- a/common/utils/nr/nr_common.c
+++ b/common/utils/nr/nr_common.c
@@ -336,9 +336,9 @@ int get_dmrs_port(int nl, uint16_t dmrs_ports) {
return p;
}
-lte_frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index)
+frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index)
{
- lte_frame_type_t current_type;
+ frame_type_t current_type;
int32_t delta_duplex = get_delta_duplex(current_band, scs_index);
if (delta_duplex == 0)
diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h
index 0150cf59f8..a09532a565 100644
--- a/common/utils/nr/nr_common.h
+++ b/common/utils/nr/nr_common.h
@@ -63,7 +63,7 @@ void get_coreset_rballoc(uint8_t *FreqDomainResource,int *n_rb,int *rb_offset);
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
int get_nr_table_idx(int nr_bandP, uint8_t scs_index);
int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index);
-lte_frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index);
+frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index);
uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex);
int NRRIV2BW(int locationAndBandwidth,int N_RB);
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c
index ff0d3c5a47..576a4d92b0 100644
--- a/executables/nr-gnb.c
+++ b/executables/nr-gnb.c
@@ -457,6 +457,7 @@ void init_gNB_Tpool(int inst) {
for (int i=0; i < 2; i++) {
notifiedFIFO_elt_t *msgL1Tx = newNotifiedFIFO_elt(sizeof(processingData_L1tx_t),0,gNB->L1_tx_out,tx_func);
processingData_L1tx_t *msgDataTx = (processingData_L1tx_t *)NotifiedFifoData(msgL1Tx);
+ memset(msgDataTx,0, sizeof(processingData_L1tx_t));
init_DLSCH_struct(gNB, msgDataTx);
memset(msgDataTx->ssb, 0, 64*sizeof(NR_gNB_SSB_t));
pushNotifiedFIFO(gNB->L1_tx_free,msgL1Tx); // to unblock the process in the beginning
diff --git a/executables/nr-softmodem-common.h b/executables/nr-softmodem-common.h
index 47fd816db5..6e36dcf6c7 100644
--- a/executables/nr-softmodem-common.h
+++ b/executables/nr-softmodem-common.h
@@ -51,7 +51,6 @@
#define CONFIG_HLP_UEFO "set UE to enable estimation and compensation of frequency offset\n"
#define CONFIG_HLP_DUMPFRAME "dump UE received frame to rxsig_frame0.dat and exit\n"
#define CONFIG_HLP_DLSHIFT "dynamic shift for LLR compuation for TM3/4 (default 0)\n"
-#define CONFIG_HLP_UELOOP "get softmodem (UE) to loop through memory instead of acquiring from HW\n"
#define CONFIG_HLP_PHYTST "test UE phy layer, mac disabled\n"
#define CONFIG_HLP_DORA "test gNB and UE with RA procedures\n"
#define CONFIG_HLP_DMAMAP "sets flag for improved EXMIMO UE performance\n"
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index 845c4f4b7d..f643344a2b 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -573,17 +573,7 @@ static void UE_synch(void *arg) {
openair0_cfg[UE->rf_map.card].rx_freq[0],
openair0_cfg[UE->rf_map.card].tx_freq[0]);
- if (UE->mode != loop_through_memory) {
- UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
- //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
- //UE->rfdevice.trx_stop_func(&UE->rfdevice);
- // sleep(1);
- /*if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
- LOG_E(HW,"Could not start the device\n");
- oai_exit=1;
- }*/
- }
-
+ UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
if (UE->UE_scan_carrier == 1) {
UE->UE_scan_carrier = 0;
} else {
@@ -602,8 +592,7 @@ static void UE_synch(void *arg) {
LOG_I(PHY, "Initial sync failed: trying carrier off %d Hz\n", freq_offset);
- if (UE->mode != loop_through_memory)
- UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
+ UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
}
break;
@@ -648,7 +637,7 @@ void processSlotTX(void *arg) {
stop_meas(&UE->ue_ul_indication_stats);
}
- if ((UE->mode != loop_through_memory) && (rxtxD->ue_sched_mode != NOT_PUSCH)) {
+ if (rxtxD->ue_sched_mode != NOT_PUSCH) {
phy_procedures_nrUE_TX(UE,proc,0);
}
}
@@ -738,9 +727,10 @@ void processSlotRX(void *arg) {
void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockSize) {
void *dummy_tx[UE->frame_parms.nb_antennas_tx];
-
+ int16_t dummy_tx_data[UE->frame_parms.nb_antennas_tx][2*writeBlockSize]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers
+ memset(dummy_tx_data, 0, sizeof(dummy_tx_data));
for (int i=0; iframe_parms.nb_antennas_tx; i++)
- dummy_tx[i]=malloc16_clear(writeBlockSize*4);
+ dummy_tx[i]=dummy_tx_data[i];
AssertFatal( writeBlockSize ==
UE->rfdevice.trx_write_func(&UE->rfdevice,
@@ -750,8 +740,6 @@ void dummyWrite(PHY_VARS_NR_UE *UE,openair0_timestamp timestamp, int writeBlockS
UE->frame_parms.nb_antennas_tx,
4),"");
- for (int i=0; iframe_parms.nb_antennas_tx; i++)
- free(dummy_tx[i]);
}
void readFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp, bool toTrash) {
@@ -793,7 +781,7 @@ void syncInFrame(PHY_VARS_NR_UE *UE, openair0_timestamp *timestamp) {
*timestamp += UE->frame_parms.get_samples_per_slot(1,&UE->frame_parms);
for ( int size=UE->rx_offset ; size > 0 ; size -= UE->frame_parms.samples_per_subframe ) {
int unitTransfer=size>UE->frame_parms.samples_per_subframe ? UE->frame_parms.samples_per_subframe : size ;
- // we write before read becasue gNB waits for UE to write and both executions halt
+ // we write before read because gNB waits for UE to write and both executions halt
// this happens here as the read size is samples_per_subframe which is very much larger than samp_per_slot
if (IS_SOFTMODEM_RFSIM) dummyWrite(UE,*timestamp, unitTransfer);
AssertFatal(unitTransfer ==
diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c
index 46fa515e0d..b1960faf7d 100644
--- a/executables/nr-uesoftmodem.c
+++ b/executables/nr-uesoftmodem.c
@@ -245,14 +245,17 @@ nrUE_params_t *get_nrUE_params(void) {
}
/* initialie thread pools used for NRUE processing paralleliation */
void init_tpools(uint8_t nun_dlsch_threads) {
- char *params = NULL;
- params = calloc(1,(NR_RX_NB_TH*NR_NB_TH_SLOT*3)+1);
+ char params[NR_RX_NB_TH*NR_NB_TH_SLOT*3+1]={0};
for (int i=0; i 0)
else
Z = (Kprime/Kb);
- LOG_D(PHY,"nr segmetation B %u Bprime %u Kprime %u z %u \n", B, Bprime, Kprime, Z);
+ LOG_D(PHY,"nr segmentation B %u Bprime %u Kprime %u z %u \n", B, Bprime, Kprime, Z);
if (Z <= 2) {
*K = 2;
diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c
index 19e6b098ba..9927085a92 100644
--- a/openair1/PHY/INIT/nr_init_ue.c
+++ b/openair1/PHY/INIT/nr_init_ue.c
@@ -359,6 +359,7 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
ue->nr_srs_info->srs_estimated_channel_time_shifted[i] = (int32_t *) malloc16_clear(fp->ofdm_symbol_size*MAX_NUM_NR_SRS_SYMBOLS*sizeof(int32_t));
}
+
// RACH
prach_vars[gNB_id]->prachF = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
prach_vars[gNB_id]->prach = (int16_t *)malloc16_clear( sizeof(int)*(7*2*sizeof(int)*(fp->ofdm_symbol_size*12)) );
@@ -455,6 +456,7 @@ void term_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB)
for (int gNB_id = 0; gNB_id < ue->n_connected_gNB; gNB_id++) {
for (int th_id = 0; th_id < RX_NB_TH_MAX; th_id++) {
+
free_and_zero(ue->pdcch_vars[th_id][gNB_id]);
}
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
index ed82aeb09e..80d9fc9cc3 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
@@ -102,7 +102,7 @@ int lte_est_freq_offset(int **dl_ch_estimates,
{
int ch_offset, omega, dl_ch_shift;
- struct complex16 omega_cpx;
+ c16_t omega_cpx;
double phase_offset;
int freq_offset_est;
unsigned char aa;
@@ -142,8 +142,8 @@ int lte_est_freq_offset(int **dl_ch_estimates,
// printf("Computing freq_offset\n");
omega = dot_product(dl_ch,dl_ch_prev,(frame_parms->N_RB_DL/2 - 1)*12,dl_ch_shift);
//omega = dot_product(dl_ch,dl_ch_prev,frame_parms->ofdm_symbol_size,15);
- omega_cpx.r = ((struct complex16*) &omega)->r;
- omega_cpx.i = ((struct complex16*) &omega)->i;
+ omega_cpx.r = ((c16_t*) &omega)->r;
+ omega_cpx.i = ((c16_t*) &omega)->i;
dl_ch = (int16_t *)&dl_ch_estimates[aa][(((frame_parms->N_RB_DL/2) + 1)*12) + ch_offset];
@@ -155,8 +155,8 @@ int lte_est_freq_offset(int **dl_ch_estimates,
// calculate omega = angle(conj(dl_ch)*dl_ch_prev))
omega = dot_product(dl_ch,dl_ch_prev,((frame_parms->N_RB_DL/2) - 1)*12,dl_ch_shift);
- omega_cpx.r += ((struct complex16*) &omega)->r;
- omega_cpx.i += ((struct complex16*) &omega)->i;
+ omega_cpx.r += ((c16_t*) &omega)->r;
+ omega_cpx.i += ((c16_t*) &omega)->i;
// phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r);
phase_offset += atan2((double)omega_cpx.i,(double)omega_cpx.r);
@@ -195,7 +195,7 @@ int lte_mbsfn_est_freq_offset(int **dl_ch_estimates,
{
int ch_offset, omega, dl_ch_shift;
- struct complex16 *omega_cpx;
+ c16_t *omega_cpx;
double phase_offset;
int freq_offset_est;
unsigned char aa;
@@ -234,7 +234,7 @@ int lte_mbsfn_est_freq_offset(int **dl_ch_estimates,
// printf("Computing freq_offset\n");
omega = dot_product(dl_ch,dl_ch_prev,(frame_parms->N_RB_DL/2 - 1)*12,dl_ch_shift);
//omega = dot_product(dl_ch,dl_ch_prev,frame_parms->ofdm_symbol_size,15);
- omega_cpx = (struct complex16*) ω
+ omega_cpx = (c16_t*) ω
// printf("omega (%d,%d)\n",omega_cpx->r,omega_cpx->i);
@@ -247,8 +247,8 @@ int lte_mbsfn_est_freq_offset(int **dl_ch_estimates,
// calculate omega = angle(conj(dl_ch)*dl_ch_prev))
omega = dot_product(dl_ch,dl_ch_prev,((frame_parms->N_RB_DL/2) - 1)*12,dl_ch_shift);
- omega_cpx->r += ((struct complex16*) &omega)->r;
- omega_cpx->i += ((struct complex16*) &omega)->i;
+ omega_cpx->r += ((c16_t*) &omega)->r;
+ omega_cpx->i += ((c16_t*) &omega)->i;
// phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r);
phase_offset += atan2((double)omega_cpx->i,(double)omega_cpx->r);
// printf("omega (%d,%d) -> %f\n",omega_cpx->r,omega_cpx->i,phase_offset);
diff --git a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
index 1fbc8b7ef2..b21f526fcc 100644
--- a/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
+++ b/openair1/PHY/LTE_ESTIMATION/lte_sync_time.c
@@ -34,9 +34,9 @@
// Note: this is for prototype of generate_drs_pusch (OTA synchronization of RRUs)
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
-static struct complex16 *primary_synch0_time __attribute__((aligned(32)));
-static struct complex16 *primary_synch1_time __attribute__((aligned(32)));
-static struct complex16 *primary_synch2_time __attribute__((aligned(32)));
+static c16_t *primary_synch0_time __attribute__((aligned(32)));
+static c16_t *primary_synch1_time __attribute__((aligned(32)));
+static c16_t *primary_synch2_time __attribute__((aligned(32)));
static void doIdft(int size, short *in, short *out) {
switch (size) {
@@ -67,7 +67,7 @@ static void doIdft(int size, short *in, short *out) {
}
}
-static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSize) {
+static void copyPrimary( c16_t *out, struct complex16 *in, int ofdmSize) {
int k=ofdmSize-36;
for (int i=0; i<72; i++) {
@@ -83,20 +83,20 @@ static void copyPrimary( struct complex16 *out, struct complex16 *in, int ofdmSi
}
int lte_sync_time_init(LTE_DL_FRAME_PARMS *frame_parms ) { // LTE_UE_COMMON *common_vars
- struct complex16 syncF_tmp[2048]__attribute__((aligned(32)))= {{0}};
+ c16_t syncF_tmp[2048]__attribute__((aligned(32)))= {{0}};
int sz=frame_parms->ofdm_symbol_size*sizeof(*primary_synch0_time);
- AssertFatal( NULL != (primary_synch0_time = (struct complex16 *)malloc16(sz)),"");
+ AssertFatal( NULL != (primary_synch0_time = (c16_t *)malloc16(sz)),"");
bzero(primary_synch0_time,sz);
- AssertFatal( NULL != (primary_synch1_time = (struct complex16 *)malloc16(sz)),"");
+ AssertFatal( NULL != (primary_synch1_time = (c16_t *)malloc16(sz)),"");
bzero(primary_synch1_time,sz);
- AssertFatal( NULL != (primary_synch2_time = (struct complex16 *)malloc16(sz)),"");
+ AssertFatal( NULL != (primary_synch2_time = (c16_t *)malloc16(sz)),"");
bzero(primary_synch2_time,sz);
// generate oversampled sync_time sequences
- copyPrimary( syncF_tmp, (struct complex16 *) primary_synch0, frame_parms->ofdm_symbol_size);
+ copyPrimary( syncF_tmp, (c16_t *) primary_synch0, frame_parms->ofdm_symbol_size);
doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch0_time);
- copyPrimary( syncF_tmp, (struct complex16 *) primary_synch1, frame_parms->ofdm_symbol_size);
+ copyPrimary( syncF_tmp, (c16_t *) primary_synch1, frame_parms->ofdm_symbol_size);
doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch1_time);
- copyPrimary( syncF_tmp, (struct complex16 *) primary_synch2, frame_parms->ofdm_symbol_size);
+ copyPrimary( syncF_tmp, (c16_t *) primary_synch2, frame_parms->ofdm_symbol_size);
doIdft(frame_parms->N_RB_DL, (short *)syncF_tmp,(short *)primary_synch2_time);
if ( LOG_DUMPFLAG(DEBUG_LTEESTIM)){
diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
index c6b312cc61..de21b7f4e2 100644
--- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
+++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c
@@ -2237,7 +2237,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB,
int P1_SHIFT[13],P2_SHIFT[13];
int offset,nushiftmod3;
- uint8_t get_pmi_temp;
+ int get_pmi_temp;
MIMO_mode_t mimo_mode = -1;
uint8_t mprime=0,Ns;
diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c
index eb46a8d663..91c419ebe3 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach.c
+++ b/openair1/PHY/LTE_TRANSPORT/prach.c
@@ -56,7 +56,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
uint8_t ce_level
) {
int i;
- lte_frame_type_t frame_type;
+ frame_type_t frame_type;
uint16_t rootSequenceIndex;
uint8_t prach_ConfigIndex;
uint8_t Ncs_config;
diff --git a/openair1/PHY/LTE_TRANSPORT/prach_common.c b/openair1/PHY/LTE_TRANSPORT/prach_common.c
index e366e8edbc..f3409a90e3 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach_common.c
+++ b/openair1/PHY/LTE_TRANSPORT/prach_common.c
@@ -399,7 +399,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex,
uint8_t prach_ConfigIndex,
uint8_t zeroCorrelationZoneConfig,
uint8_t highSpeedFlag,
- lte_frame_type_t frame_type,
+ frame_type_t frame_type,
uint32_t X_u[64][839]) {
// Compute DFT of x_u => X_u[k] = x_u(inv(u)*k)^* X_u[k] = exp(j\pi u*inv(u)*k*(inv(u)*k+1)/N_ZC)
unsigned int k,inv_u,i,NCS=0,num_preambles;
diff --git a/openair1/PHY/LTE_TRANSPORT/prach_extern.h b/openair1/PHY/LTE_TRANSPORT/prach_extern.h
index 3404646923..3403861011 100644
--- a/openair1/PHY/LTE_TRANSPORT/prach_extern.h
+++ b/openair1/PHY/LTE_TRANSPORT/prach_extern.h
@@ -81,7 +81,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex,
uint8_t prach_ConfigIndex,
uint8_t zeroCorrelationZoneConfig,
uint8_t highSpeedFlag,
- lte_frame_type_t frame_type,
+ frame_type_t frame_type,
uint32_t X_u[64][839]);
#endif
diff --git a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
index af8e63c3ed..57a7b2ec91 100644
--- a/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
+++ b/openair1/PHY/LTE_TRANSPORT/transport_common_proto.h
@@ -224,7 +224,7 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id);
@returns 0-1 accordingly
*/
/*
-uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
+uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,frame_type_t frame_type);
*/
/*!
@@ -247,7 +247,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex,
uint8_t prach_ConfigIndex,
uint8_t zeroCorrelationZoneConfig,
uint8_t highSpeedFlag,
- lte_frame_type_t frame_type,
+ frame_type_t frame_type,
uint32_t X_u[64][839]);
@@ -299,7 +299,7 @@ uint64_t pmi2hex_2Ar1(uint32_t pmi);
uint64_t pmi2hex_2Ar2(uint32_t pmi);
-uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb);
+uint8_t get_pmi(int N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb);
// DL power control functions
double get_pa_dB(uint8_t pa);
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
index efde277203..088e2c0a5e 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c
@@ -64,7 +64,7 @@ extern uint16_t beta_cqi[16];
extern uint16_t beta_ri[16];
extern uint16_t beta_ack[16];
-void extract_dci1A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
+void extract_dci1A_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
{
uint8_t harq_pid=0;
uint32_t rballoc=0;
@@ -182,7 +182,7 @@ void extract_dci1A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_
pdci_info_extarcted->dai = dai;
}
-void extract_dci1C_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
+void extract_dci1C_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
{
uint32_t rballoc=0;
@@ -222,7 +222,7 @@ void extract_dci1C_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_
pdci_info_extarcted->Ngap = Ngap;
}
-void extract_dci1_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
+void extract_dci1_info(uint8_t N_RB_DL, frame_type_t frame_type, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
{
uint32_t rballoc=0;
@@ -329,7 +329,7 @@ void extract_dci1_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, void *dci_p
}
-void extract_dci2_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
+void extract_dci2_info(uint8_t N_RB_DL, frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
{
uint32_t rballoc=0;
@@ -615,7 +615,7 @@ void extract_dci2_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_
}
-void extract_dci2A_info(uint8_t N_RB_DL, lte_frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
+void extract_dci2A_info(uint8_t N_RB_DL, frame_type_t frame_type, uint8_t nb_antenna_ports_eNB, void *dci_pdu, DCI_INFO_EXTRACTED_t *pdci_info_extarcted)
{
uint32_t rballoc=0;
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c b/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c
index 7bbe8e8942..6ab2ad9fdd 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/get_pmi.c
@@ -21,7 +21,7 @@
#include "PHY/LTE_UE_TRANSPORT/transport_proto_ue.h"
-uint8_t get_pmi(uint8_t N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb)
+uint8_t get_pmi(int N_RB_DL, MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb)
{
/*
MIMO_mode_t mode = dlsch_harq->mimo_mode;
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
index 82120dc3c3..4faa8367c3 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
+++ b/openair1/PHY/LTE_UE_TRANSPORT/prach_ue.c
@@ -46,7 +46,7 @@
//#define PRACH_DEBUG 1
int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint16_t Nf ) {
- lte_frame_type_t frame_type = ue->frame_parms.frame_type;
+ frame_type_t frame_type = ue->frame_parms.frame_type;
//uint8_t tdd_config = ue->frame_parms.tdd_config;
uint16_t rootSequenceIndex = ue->frame_parms.prach_config_common.rootSequenceIndex;
uint8_t prach_ConfigIndex = ue->frame_parms.prach_config_common.prach_ConfigInfo.prach_ConfigIndex;
diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
index c5d096ceb7..f5b8c6b64a 100644
--- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
+++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h
@@ -1550,16 +1550,6 @@ uint64_t cqi2hex(uint32_t cqi);
uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
-
-/** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function
- @param N_RB_DL number of resource blocks
- @param mimo_mode
- @param pmi_alloc subband PMI bitmap
- @param rb resource block for which to extract PMI
- @returns subband PMI
-*/
-uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb);
-
int get_nCCE_offset_l1(int *CCE_table,
const unsigned char L,
const int nCCE,
@@ -1669,7 +1659,7 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id);
@param frame_type 0-FDD, 1-TDD
@returns 0-1 accordingly
*/
-uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
+uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,frame_type_t frame_type);
/*!
\brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index
@@ -1691,7 +1681,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex,
uint8_t prach_ConfigIndex,
uint8_t zeroCorrelationZoneConfig,
uint8_t highSpeedFlag,
- lte_frame_type_t frame_type,
+ frame_type_t frame_type,
uint32_t X_u[64][839]);
diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
index f4761489f5..aec5e1b12b 100644
--- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
+++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c
@@ -107,25 +107,20 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int slot, int first_symb,int num_symb
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
NR_gNB_COMMON *common_vars = &gNB->common_vars;
PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements;
- int rb, offset, offset0, nb_symb[275], len;
- int32_t *ul_ch;
-
- LOG_D(PHY,"slot %d Doing I0 for first_symb %d, num_symb %d\n",slot,first_symb,num_symb);
+ int rb, nb_symb[275]={0};
+
+ memset(measurements->n0_subband_power, 0, sizeof(measurements->n0_subband_power));
+
for (int s=first_symb;s<(first_symb+num_symb);s++) {
for (rb=0; rbN_RB_UL; rb++) {
-
- if (s==first_symb) {
- nb_symb[rb]=0;
- for (int aarx=0; aarxnb_antennas_rx;aarx++)
- measurements->n0_subband_power[aarx][rb]=0;
- }
- offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) + (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
+ int offset0 = (slot&3)*(frame_parms->symbols_per_slot * frame_parms->ofdm_symbol_size) +
+ (frame_parms->first_carrier_offset + (rb*12))%frame_parms->ofdm_symbol_size;
if ((gNB->rb_mask_ul[s][rb>>5]&(1<<(rb&31))) == 0) { // check that rb was not used in this subframe
nb_symb[rb]++;
for (int aarx=0; aarxnb_antennas_rx; aarx++) {
- offset = offset0 + (s*frame_parms->ofdm_symbol_size);
- ul_ch = &common_vars->rxdataF[aarx][offset];
- len = 12;
+ int offset = offset0 + (s*frame_parms->ofdm_symbol_size);
+ int32_t *ul_ch = &common_vars->rxdataF[aarx][offset];
+ int len = 12;
if (((frame_parms->N_RB_UL&1) == 1) &&
(rb==(frame_parms->N_RB_UL>>1))) {
len=6;
diff --git a/openair1/PHY/NR_REFSIG/pss_nr.h b/openair1/PHY/NR_REFSIG/pss_nr.h
index b32d48a2e9..c65ca3799d 100644
--- a/openair1/PHY/NR_REFSIG/pss_nr.h
+++ b/openair1/PHY/NR_REFSIG/pss_nr.h
@@ -113,12 +113,6 @@ EXTERN int16_t *primary_synchro_time_nr[NUMBER_PSS_SEQUENCE]
#endif
;
-EXTERN int64_t *pss_corr_ue[NUMBER_PSS_SEQUENCE]
-#ifdef INIT_VARIABLES_PSS_NR_H
-= { NULL, NULL, NULL}
-#endif
-;
-
/* profiling structure */
EXTERN time_stats_t generic_time[TIME_LAST];
diff --git a/openair1/PHY/NR_REFSIG/ptrs_nr.c b/openair1/PHY/NR_REFSIG/ptrs_nr.c
index 40a6a56611..68134eb02d 100644
--- a/openair1/PHY/NR_REFSIG/ptrs_nr.c
+++ b/openair1/PHY/NR_REFSIG/ptrs_nr.c
@@ -268,8 +268,8 @@ void nr_ptrs_cpe_estimation(uint8_t K_ptrs,
return;
}
uint16_t sc_per_symbol = (nb_rb + K_ptrs - 1)/K_ptrs;
- struct complex16 ptrs_p[(1 + sc_per_symbol/4)*4];
- struct complex16 dmrs_comp_p[(1 + sc_per_symbol/4)*4];
+ c16_t ptrs_p[(1 + sc_per_symbol/4)*4];
+ c16_t dmrs_comp_p[(1 + sc_per_symbol/4)*4];
double abs = 0.0;
double real = 0.0;
double imag = 0.0;
@@ -422,7 +422,7 @@ void get_slope_from_estimates(uint8_t start, uint8_t end, int16_t *est_p, double
/* estimate from slope */
void ptrs_estimate_from_slope(int16_t *error_est, double *slope_p, uint8_t start, uint8_t end)
{
- struct complex16 *error=(struct complex16 *) error_est;
+ c16_t *error=(struct complex16 *) error_est;
for(uint8_t i = 1; i< (end -start);i++) {
error[start+i].r = error[start].r + (int16_t)(i * slope_p[0]);// real
error[start+i].i = error[start].i + (int16_t)(i * slope_p[1]); //imag
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c
index ba7e539429..4796164036 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dci.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c
@@ -141,6 +141,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
polar_encoder_fast((uint64_t*)dci_pdu->Payload, (void*)encoder_output, n_RNTI, 1,
NR_POLAR_DCI_MESSAGE_TYPE, dci_pdu->PayloadSizeBits, dci_pdu->AggregationLevel);
#ifdef DEBUG_CHANNEL_CODING
+//debug dump dci
printf("polar rnti %x,length %d, L %d\n",n_RNTI, dci_pdu->PayloadSizeBits,pdcch_pdu_rel15->dci_pdu->AggregationLevel);
printf("DCI PDU: [0]->0x%lx \t [1]->0x%lx\n",
((uint64_t*)dci_pdu->Payload)[0], ((uint64_t*)dci_pdu->Payload)[1]);
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c
index 19b56f6dba..2c4fb26c5a 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c
@@ -129,7 +129,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
start_meas(dlsch_encoding_stats);
if (nr_dlsch_encoding(gNB,
- harq->pdu, frame, slot, dlsch, frame_parms,output,tinput,tprep,tparity,toutput,
+ frame, slot, harq, frame_parms,output,tinput,tprep,tparity,toutput,
dlsch_rate_matching_stats,
dlsch_interleaving_stats,
dlsch_segmentation_stats) == -1)
@@ -163,6 +163,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
rel15->dataScramblingId,
rel15->rnti,
scrambled_output);
+
#ifdef DEBUG_DLSCH
printf("PDSCH scrambling:\n");
for (int i=0; i>8; i++) {
@@ -171,6 +172,7 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx,
printf("\n");
}
#endif
+
stop_meas(dlsch_scrambling_stats);
/// Modulation
start_meas(dlsch_modulation_stats);
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h
index 28676b49f2..daa4ed1723 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.h
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.h
@@ -78,9 +78,9 @@ int16_t find_nr_dlsch(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
NR_gNB_SCH_STATS_t *find_nr_dlsch_stats(uint16_t rnti, PHY_VARS_gNB *gNB,find_type_t type);
int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
- unsigned char *a,int frame,
+ int frame,
uint8_t slot,
- NR_gNB_DLSCH_t *dlsch,
+ NR_DL_gNB_HARQ_t *harq,
NR_DL_FRAME_PARMS* frame_parms,
unsigned char * output,
time_stats_t *tinput,
diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
index 229f59032e..bf33457aaa 100644
--- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
+++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c
@@ -286,10 +286,9 @@ void ldpc8blocks( void *p) {
}
int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
- unsigned char *a,
int frame,
uint8_t slot,
- NR_gNB_DLSCH_t *dlsch,
+ NR_DL_gNB_HARQ_t *harq,
NR_DL_FRAME_PARMS *frame_parms,
unsigned char * output,
time_stats_t *tinput,time_stats_t *tprep,time_stats_t *tparity,time_stats_t *toutput,
@@ -298,13 +297,12 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
encoder_implemparams_t impp;
impp.output=output;
unsigned int crc=1;
- NR_DL_gNB_HARQ_t *harq = &dlsch->harq_process;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *rel15 = &harq->pdsch_pdu.pdsch_pdu_rel15;
- impp.Zc = &dlsch->harq_process.Z;
+ impp.Zc = &harq->Z;
float Coderate = 0.0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ENCODING, VCD_FUNCTION_IN);
uint32_t A = rel15->TBSize[0]<<3;
-
+ unsigned char *a=harq->pdu;
if ( rel15->rnti != SI_RNTI)
trace_NRpdu(DIRECTION_DOWNLINK, a, rel15->TBSize[0], 0, WS_C_RNTI, rel15->rnti, frame, slot,0, 0);
@@ -317,14 +315,14 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
stats=&gNB->dlsch_stats[i];
}
- if (gNB->dlsch_stats[i].rnti == dlsch->rnti) {
+ if (gNB->dlsch_stats[i].rnti == rel15->rnti) {
stats=&gNB->dlsch_stats[i];
break;
}
}
if (stats) {
- stats->rnti = dlsch->rnti;
+ stats->rnti = rel15->rnti;
stats->total_bytes_tx += rel15->TBSize[0];
stats->current_RI = rel15->nrOfLayers;
stats->current_Qm = rel15->qamModOrder[0];
diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c
index 50c3b62f50..cd368a68cc 100644
--- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c
+++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c
@@ -243,7 +243,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
* x(l*12+n) = r_u_v_alpha_delta(n)
*/
// the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1
- uint8_t u[2]={0,0},v[2]={0,0};
+ uint8_t u[2]={0},v[2]={0};
// x_n contains the sequence r_u_v_alpha_delta(n)
@@ -262,7 +262,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
AssertFatal(pucch_pdu->nr_of_symbols < 3,"nr_of_symbols %d not allowed\n",pucch_pdu->nr_of_symbols);
- uint32_t re_offset[2]={0,0};
+ uint32_t re_offset[2]={0};
uint8_t l2;
const int16_t *x_re[2],*x_im[2];
@@ -271,16 +271,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
x_re[1] = table_5_2_2_2_2_Re[u[1]];
x_im[1] = table_5_2_2_2_2_Im[u[1]];
- int16_t xr[1+frame_parms->nb_antennas_rx][1+pucch_pdu->nr_of_symbols][24] __attribute__((aligned(32)));
+ c64_t xr[frame_parms->nb_antennas_rx][pucch_pdu->nr_of_symbols][12] __attribute__((aligned(32)));
int64_t xrtmag=0,xrtmag_next=0;
uint8_t maxpos=0;
uint8_t index=0;
- for (int l=0; lnr_of_symbols; l++) {
- for (int aarx=0;aarxnb_antennas_rx;aarx++) {
- memset((void*)xr[aarx][l],0,24*sizeof(int16_t));
- }
- }
- int n2;
for (int l=0; lnr_of_symbols; l++) {
l2 = l+pucch_pdu->start_symbol_index;
@@ -289,75 +283,68 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
re_offset[l]-=frame_parms->ofdm_symbol_size;
AssertFatal(re_offset[l]+12 < frame_parms->ofdm_symbol_size,"pucch straddles DC carrier, handle this!\n");
- int16_t *r;
for (int aa=0;aanb_antennas_rx;aa++) {
- r=(int16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]];
- n2=0;
- for (n=0;n<12;n++,n2+=2) {
- xr[aa][l][n2] +=(int16_t)(((int32_t)x_re[l][n]*r[n2]+(int32_t)x_im[l][n]*r[n2+1])>>15);
- xr[aa][l][n2+1]+=(int16_t)(((int32_t)x_re[l][n]*r[n2+1]-(int32_t)x_im[l][n]*r[n2])>>15);
+ c16_t *r=(c16_t*)&rxdataF[aa][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[l]];
+ for (n=0;n<12;n++) {
+ xr[aa][l][n].r = (int32_t)x_re[l][n] * r[n].r + (int32_t)x_im[l][n] * r[n].i;
+ xr[aa][l][n].i = (int32_t)x_re[l][n] * r[n].i - (int32_t)x_im[l][n] * r[n].r;
#ifdef DEBUG_NR_PUCCH_RX
- printf("x (%d,%d), r%d.%d (%d,%d), xr (%d,%d)\n",
- x_re[l][n],x_im[l][n],l2,re_offset[l],r[n2],r[n2+1],xr[aa][l][n2],xr[aa][l][n2+1]);
+ printf("x (%d,%d), r%d.%d (%d,%d), xr (%lld,%lld)\n",
+ x_re[l][n],x_im[l][n],l2,re_offset[l],r[n].r,r[n].i,xr[aa][l][n].r,xr[aa][l][n].i);
#endif
}
}
}
- int32_t corr_re[1+frame_parms->nb_antennas_rx][2];
- int32_t corr_im[1+frame_parms->nb_antennas_rx][2];
//int32_t no_corr = 0;
int seq_index = 0;
int64_t temp;
for(i=0;inr_of_symbols;l++) {
- seq_index = (pucch_pdu->initial_cyclic_shift+
- mcs[i]+
- gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12;
+ c64_t corr[frame_parms->nb_antennas_rx][2];
+ for (int aa=0;aanb_antennas_rx;aa++) {
+ for (int l=0;lnr_of_symbols;l++) {
+ seq_index = (pucch_pdu->initial_cyclic_shift+
+ mcs[i]+
+ gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12;
#ifdef DEBUG_NR_PUCCH_RX
- printf("PUCCH symbol %d seq %d, seq_index %d, mcs %d\n",l,i,seq_index,mcs[i]);
+ printf("PUCCH symbol %d seq %d, seq_index %d, mcs %d\n",l,i,seq_index,mcs[i]);
#endif
- for (int aa=0;aanb_antennas_rx;aa++) {
- corr_re[aa][l]=0;
- corr_im[aa][l]=0;
-
- n2=0;
- for (n=0;n<12;n++,n2+=2) {
- corr_re[aa][l]+=(xr[aa][l][n2]*idft12_re[seq_index][n]+xr[aa][l][n2+1]*idft12_im[seq_index][n])>>15;
- corr_im[aa][l]+=(xr[aa][l][n2]*idft12_im[seq_index][n]-xr[aa][l][n2+1]*idft12_re[seq_index][n])>>15;
+ corr[aa][l]=(c64_t){0};
+ for (n = 0; n < 12; n++) {
+ corr[aa][l].r += xr[aa][l][n].r * idft12_re[seq_index][n] + xr[aa][l][n].i * idft12_im[seq_index][n];
+ corr[aa][l].i += xr[aa][l][n].r * idft12_im[seq_index][n] - xr[aa][l][n].i * idft12_re[seq_index][n];
}
+ corr[aa][l].r >>= 31;
+ corr[aa][l].i >>= 31;
}
}
- LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n",
- mcs[i],seq_index,corr_re[0][0],corr_im[0][0],
- 10*log10((double)corr_re[0][0]*corr_re[0][0] + (double)corr_im[0][0]*corr_im[0][0]));
+ LOG_D(PHY,"PUCCH IDFT[%d/%d] = (%ld,%ld)=>%f\n",
+ mcs[i],seq_index,corr[0][0].r,corr[0][0].i,
+ 10*log10((double)squaredMod(corr[0][0])));
if (pucch_pdu->nr_of_symbols==2)
- LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",
- mcs[i],seq_index,corr_re[0][1],corr_im[0][1],
- 10*log10((double)corr_re[0][1]*corr_re[0][1] + (double)corr_im[0][1]*corr_im[0][1]));
+ LOG_D(PHY,"PUCCH 2nd symbol IDFT[%d/%d] = (%ld,%ld)=>%f\n",
+ mcs[i],seq_index,corr[0][1].r,corr[0][1].i,
+ 10*log10((double)squaredMod(corr[0][1])));
if (pucch_pdu->freq_hop_flag == 0) {
if (pucch_pdu->nr_of_symbols==1) {// non-coherent correlation
temp=0;
for (int aa=0;aanb_antennas_rx;aa++)
- temp+=(int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0];
+ temp+=squaredMod(corr[aa][0]);
} else {
- int64_t corr_re2=0;
- int64_t corr_im2=0;
temp=0;
for (int aa=0;aanb_antennas_rx;aa++) {
- corr_re2 = (int64_t)corr_re[aa][0]+corr_re[aa][1];
- corr_im2 = (int64_t)corr_im[aa][0]+corr_im[aa][1];
- // coherent combining of 2 symbols and then complex modulus for single-frequency case
- temp+=corr_re2*corr_re2 + corr_im2*corr_im2;
+ c64_t corr2;
+ csum(corr2, corr[aa][0], corr[aa][1]);
+ // coherent combining of 2 symbols and then complex modulus for single-frequency case
+ temp+=corr2.r*corr2.r + corr2.i*corr2.i;
}
}
} else if (pucch_pdu->freq_hop_flag == 1) {
// full non-coherent combining of 2 symbols for frequency-hopping case
temp=0;
for (int aa=0;aanb_antennas_rx;aa++)
- temp += (int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0] + (int64_t)corr_re[aa][1]*corr_re[aa][1] + (int64_t)corr_im[aa][1]*corr_im[aa][1];
+ temp += squaredMod(corr[aa][0]) + squaredMod(corr[aa][1]);
}
else AssertFatal(1==0,"shouldn't happen\n");
@@ -369,9 +356,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_stats->current_pucch0_stat0 = 0;
int64_t temp2=0,temp3=0;;
for (int aa=0;aanb_antennas_rx;aa++) {
- temp2 += ((int64_t)corr_re[aa][0]*corr_re[aa][0] + (int64_t)corr_im[aa][0]*corr_im[aa][0]);
+ temp2 += squaredMod(corr[aa][0]);
if (pucch_pdu->nr_of_symbols==2)
- temp3 += ((int64_t)corr_re[aa][1]*corr_re[aa][1] + (int64_t)corr_im[aa][1]*corr_im[aa][1]);
+ temp3 += squaredMod(corr[aa][1]);
}
uci_stats->current_pucch0_stat0= dB_fixed64(temp2);
if ( pucch_pdu->nr_of_symbols==2)
@@ -392,7 +379,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_stats->pucch0_n01 = gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]];
LOG_D(PHY,"n00[%d] = %d, n01[%d] = %d\n",prb_offset[0],uci_stats->pucch0_n00,prb_offset[1],uci_stats->pucch0_n01);
// estimate CQI for MAC (from antenna port 0 only)
- int max_n0 = uci_stats->pucch0_n00>uci_stats->pucch0_n01 ? uci_stats->pucch0_n00:uci_stats->pucch0_n01;
+ int max_n0 = max(gNB->measurements.n0_subband_power_tot_dB[prb_offset[0]],
+ gNB->measurements.n0_subband_power_tot_dB[prb_offset[1]]);
int SNRtimes10,sigenergy=0;
for (int aa=0;aanb_antennas_rx;aa++)
sigenergy += signal_energy_nodc(&rxdataF[aa][soffset+
@@ -407,8 +395,15 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_stats->pucch0_thres = gNB->pucch0_thres; /* + (10*max_n0);*/
bool no_conf=false;
if (nr_sequences>1) {
- if (xrtmag_dBtimes10 < (50+xrtmag_next_dBtimes10) || SNRtimes10 < uci_stats->pucch0_thres)
+ if (xrtmag_dBtimes10 < (50+xrtmag_next_dBtimes10) || SNRtimes10 < gNB->pucch0_thres) {
no_conf=true;
+ LOG_D(PHY,"%d.%d PUCCH bad confidence: %d threshold, %d, %d, %d\n",
+ frame, slot,
+ uci_stats->pucch0_thres,
+ SNRtimes10,
+ xrtmag_dBtimes10,
+ xrtmag_next_dBtimes10);
+ }
}
gNB->bad_pucch += no_conf;
// first bit of bitmap for sr presence and second bit for acknack presence
@@ -422,11 +417,12 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
if (pucch_pdu->bit_len_harq==0) {
uci_pdu->harq = NULL;
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
- uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0;
+ uci_pdu->sr->sr_confidence_level = SNRtimes10 < uci_stats->pucch0_thres;
uci_stats->pucch0_sr_trials++;
- if (xrtmag_dBtimes10>(10*gNB->measurements.n0_power_tot_dB)) {
+ if (xrtmag_dBtimes10>(10*max_n0+100)) {
uci_pdu->sr->sr_indication = 1;
uci_stats->pucch0_positive_SR++;
+ LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR);
} else {
uci_pdu->sr->sr_indication = 0;
}
@@ -434,35 +430,50 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
else if (pucch_pdu->bit_len_harq==1) {
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
uci_pdu->harq->num_harq = 1;
- uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0;
- uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
+ uci_pdu->harq->harq_confidence_level = no_conf;
+ uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(sizeof *uci_pdu->harq->harq_list);
uci_pdu->harq->harq_list[0].harq_value = !(index&0x01);
- LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ value %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad) xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n",
- frame,slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos);
+ LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ %s with confidence level %s xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d, energy %f, sync_pos %d\n",
+ frame,slot,uci_pdu->harq->harq_list[0].harq_value==0?"ACK":"NACK",
+ uci_pdu->harq->harq_confidence_level==0?"good":"bad",
+ xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,10*log10((double)sigenergy),gNB->ulsch_stats[0].sync_pos);
if (pucch_pdu->sr_flag == 1) {
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
- uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
- uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0;
- uci_stats->pucch0_positive_SR++;
+ uci_pdu->sr->sr_indication = (index>1);
+ uci_pdu->sr->sr_confidence_level = no_conf;
+ if(uci_pdu->sr->sr_indication == 1 && uci_pdu->sr->sr_confidence_level == 0) {
+ uci_stats->pucch0_positive_SR++;
+ LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR);
+ }
}
uci_stats->pucch01_trials++;
}
else {
uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq));
uci_pdu->harq->num_harq = 2;
- uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0;
- uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
+ uci_pdu->harq->harq_confidence_level = no_conf;
+ uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2 * sizeof( *uci_pdu->harq->harq_list));
uci_pdu->harq->harq_list[1].harq_value = !(index&0x01);
uci_pdu->harq->harq_list[0].harq_value = !((index>>1)&0x01);
- LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values %d and %d (0 pass, 1 fail) with confidence level %d (0 is good, 1 is bad), xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n",
- frame,slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level,xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,SNRtimes10,gNB->ulsch_stats[0].sync_pos);
+ LOG_D(PHY, "[DLSCH/PDSCH/PUCCH] %d.%d HARQ values (%s, %s) with confidence level %s, xrt_mag %d xrt_mag_next %d n0 %d (%d,%d) pucch0_thres %d, cqi %d, SNRtimes10 %d,sync_pos %d\n",
+ frame,slot,
+ uci_pdu->harq->harq_list[1].harq_value == 0 ? "ACK" : "NACK",
+ uci_pdu->harq->harq_list[0].harq_value == 0 ? "ACK" : "NACK",
+ uci_pdu->harq->harq_confidence_level == 0 ? "good" : "bad",
+ xrtmag_dBtimes10,xrtmag_next_dBtimes10,max_n0,
+ uci_stats->pucch0_n00,uci_stats->pucch0_n01,uci_stats->pucch0_thres,cqi,
+ SNRtimes10,gNB->ulsch_stats[0].sync_pos);
if (pucch_pdu->sr_flag == 1) {
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
- uci_pdu->sr->sr_confidence_level = (no_conf) ? 1 : 0;
+ uci_pdu->sr->sr_confidence_level = no_conf;
+ if(uci_pdu->sr->sr_indication == 1 && uci_pdu->sr->sr_confidence_level == 0) {
+ uci_stats->pucch0_positive_SR++;
+ LOG_D(PHY,"PUCCH0 got positive SR. Cumulative number of positive SR %d\n", uci_stats->pucch0_positive_SR);
+ }
}
}
}
@@ -1671,7 +1682,8 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
LOG_D(PHY,"metric %d dB\n",corr_dB);
}
- // estimate CQI for MAC (from antenna port 0 only)
+ // estimate CQI for MAC (from antenna port 0 only)
+ // TODO this computation is wrong -> to be ignored at MAC for now
int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][soffset+(l2*frame_parms->ofdm_symbol_size)+re_offset[0]],
12*pucch_pdu->prb_size)) -
(10*gNB->measurements.n0_power_tot_dB);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
index 5fe29b1f28..336d388d40 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/dci_nr.c
@@ -80,8 +80,8 @@ char nr_dci_format_string[8][30] = {
//static const int16_t conjugate[8]__attribute__((aligned(32))) = {-1,1,-1,1,-1,1,-1,1};
-void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
- uint32_t *z,
+static void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
+ uint32_t *e_rx,
uint8_t coreset_time_dur,
uint8_t start_symbol,
uint32_t coreset_nbr_rb,
@@ -187,10 +187,10 @@ void nr_pdcch_demapping_deinterleaving(uint32_t *llr,
index_z = data_sc * rb_count;
index_llr = (uint16_t) (f*B_rb + rb + symbol_idx * coreset_nbr_rb) * data_sc;
for (int i = 0; i < data_sc; i++) {
- z[index_z + i] = llr[index_llr + i];
+ e_rx[index_z + i] = llr[index_llr + i];
#ifdef NR_PDCCH_DCI_DEBUG
LOG_I(PHY,"[candidate=%d,symbol_idx=%d,cce=%d,REG bundle=%d,PRB=%d] z[%d]=(%d,%d) <-> \t llr[%d]=(%d,%d) \n",
- c_id,symbol_idx,cce_count,k,f*B_rb + rb,(index_z + i),*(int16_t *) &z[index_z + i],*(1 + (int16_t *) &z[index_z + i]),
+ c_id,symbol_idx,cce_count,k,f*B_rb + rb,(index_z + i),*(int16_t *) &e_rx[index_z + i],*(1 + (int16_t *) &e_rx[index_z + i]),
(index_llr + i),*(int16_t *) &llr[index_llr + i], *(1 + (int16_t *) &llr[index_llr + i]));
#endif
}
@@ -798,7 +798,7 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
-void nr_pdcch_unscrambling(int16_t *z,
+void nr_pdcch_unscrambling(int16_t *e_rx,
uint16_t scrambling_RNTI,
uint32_t length,
uint16_t pdcch_DMRS_scrambling_id,
@@ -821,8 +821,10 @@ void nr_pdcch_unscrambling(int16_t *z,
reset = 0;
}
- if (((s >> (i % 32)) & 1) == 1) z2[i] = -z[i];
- else z2[i]=z[i];
+ if (((s >> (i % 32)) & 1) == 1)
+ z2[i] = -e_rx[i];
+ else
+ z2[i]=e_rx[i];
}
}
@@ -875,6 +877,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
int L = rel15->L[j];
// Loop over possible DCI lengths
+
for (int k = 0; k < rel15->num_dci_options; k++) {
// skip this candidate if we've already found one with the
// same rnti and format at a different aggregation level
@@ -893,10 +896,11 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
LOG_D(PHY, "(%i.%i) Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n",
proc->frame_rx, proc->nr_slot_rx, j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length, nr_dci_format_string[rel15->dci_format_options[k]]);
+
nr_pdcch_unscrambling(&pdcch_e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e);
#ifdef DEBUG_DCI_DECODING
- uint32_t *z = (uint32_t *) &pdcch_vars->e_rx[e_rx_cand_idx];
+ uint32_t *z = (uint32_t *) &e_rx[e_rx_cand_idx];
for (int index_z = 0; index_z < L*6; index_z++){
for (int i=0; i<9; i++) {
LOG_I(PHY,"z[%d]=(%d,%d) \n", (9*index_z + i), *(int16_t *) &z[9*index_z + i],*(1 + (int16_t *) &z[9*index_z + i]));
@@ -909,8 +913,8 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L);
n_rnti = rel15->rnti;
- LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d)\n",
- proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length);
+ LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx )\n",
+ proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length, *(unsigned long long*)dci_estimation);
if (crc == n_rnti) {
LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n",
proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length,*(unsigned long long*)dci_estimation);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
index ebe077d635..95d2cd9577 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c
@@ -168,6 +168,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
memset(dlsch->harq_processes[i]->d[r],0,5*8448);
else
exit_flag=2;
+
}
} else {
exit_flag=1;
@@ -221,7 +222,7 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
// phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round);
harq_process->status = SCH_IDLE;
- harq_process->round = 0;
+ harq_process->DLround = 0;
harq_process->ack = 1;
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d)\n",
@@ -236,9 +237,9 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool
//LOG_D(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n",
// phy_vars_ue->Mod_id, frame, nr_slot_rx, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round);
harq_process->ack = 0;
- if (harq_process->round >= dlsch->Mlimit) {
+ if (harq_process->DLround >= dlsch->Mlimit) {
harq_process->status = SCH_IDLE;
- harq_process->round = 0;
+ harq_process->DLround = 0;
phy_vars_ue->dl_stats[4]++;
}
@@ -295,14 +296,14 @@ void nr_processDLSegment(void* arg) {
K_bits_F = Kr-harq_process->F;
t_nrLDPC_time_stats procTime = {0};
- t_nrLDPC_time_stats* p_procTime = &procTime ;
- int16_t w[5*8448];
- memset(w,0,(5*8448)*sizeof(short));
+
start_meas(&rdata->ts_deinterleave);
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN);
+ int16_t w[E];
+ memset(w, 0, sizeof(w));
nr_deinterleaving_ldpc(E,
Qm,
w, // [hna] w is e
@@ -389,12 +390,12 @@ void nr_processDLSegment(void* arg) {
no_iteration_ldpc = nrLDPC_decoder(p_decoderParms,
(int8_t *)&pl[0],
llrProcBuf,
- p_procTime);
+ &procTime);
//VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT);
// Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int
if (check_crc((uint8_t *)llrProcBuf,length_dec,harq_process->F,crc_type)) {
- LOG_D(PHY,"Segment %u CRC OK\n\033[0m",r);
+ LOG_D(PHY,"Segment %u CRC OK\n",r);
if (r==0) {
for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]);
@@ -404,7 +405,7 @@ void nr_processDLSegment(void* arg) {
no_iteration_ldpc = dlsch->max_ldpc_iterations;
rdata->decodeIterations = no_iteration_ldpc;
} else {
- LOG_D(PHY,"CRC NOT OK\n\033[0m");
+ LOG_D(PHY,"CRC NOT OK\n");
}
nb_total_decod++;
@@ -447,8 +448,8 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
}
// HARQ stats
- phy_vars_ue->dl_stats[harq_process->round]++;
- LOG_D(PHY,"Round %d RV idx %d\n",harq_process->round,harq_process->rvidx);
+ phy_vars_ue->dl_stats[harq_process->DLround]++;
+ LOG_D(PHY,"Round %d RV idx %d\n",harq_process->DLround,harq_process->rvidx);
uint8_t kc;
uint32_t Tbslbrm;// = 950984;
uint16_t nb_rb;// = 30;
@@ -501,7 +502,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
}
*/
nb_rb = harq_process->nb_rb;
- harq_process->trials[harq_process->round]++;
+ harq_process->trials[harq_process->DLround]++;
uint16_t nb_rb_oh = 0; // it was not computed at UE side even before and set to 0 in nr_compute_tbs
harq_process->TBS = nr_compute_tbs(harq_process->Qm,harq_process->R,nb_rb,nb_symb_sch,nb_re_dmrs*dmrs_length, nb_rb_oh, 0, harq_process->Nl);
A = harq_process->TBS;
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
index 69eccaf02e..9cedc33356 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c
@@ -117,7 +117,6 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars,
unsigned char first_symbol_flag,
unsigned char symbol,
unsigned short nb_rb,
- unsigned short round,
int32_t codeword_TB0,
int32_t codeword_TB1,
uint32_t len,
@@ -154,7 +153,6 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
unsigned char aatx=0,aarx=0;
- unsigned short round;
int avgs = 0;// rb;
NR_DL_UE_HARQ_t *dlsch0_harq, *dlsch1_harq = NULL;
@@ -278,8 +276,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nb_rb_pdsch = dlsch0_harq->nb_rb;
DevAssert(dlsch0_harq);
- round = dlsch0_harq->round;
- //printf("round = %d\n", round);
+
if (gNB_id > 2) {
LOG_W(PHY, "In %s: Illegal gNB_id %d\n", __FUNCTION__, gNB_id);
@@ -522,7 +519,7 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
rx_type, harq_pid,
gNB_id, gNB_id_i,
first_symbol_flag,
- i, nb_rb_pdsch, round,
+ i, nb_rb_pdsch,
codeword_TB0, codeword_TB1,
pdsch_vars[gNB_id]->dl_valid_re[i-1],
nr_slot_rx, beamforming_mode);
@@ -2479,7 +2476,6 @@ static int nr_dlsch_llr(NR_UE_PDSCH **pdsch_vars,
unsigned char first_symbol_flag,
unsigned char symbol,
unsigned short nb_rb,
- unsigned short round,
int32_t codeword_TB0,
int32_t codeword_TB1,
uint32_t len,
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
index 3e710c7c33..e248ce87cb 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c
@@ -308,7 +308,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
#endif
int freq_offset_sss = 0;
- rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp, &freq_offset_sss);
+ ret = rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp, &freq_offset_sss);
accumulated_freq_offset += freq_offset_sss;
@@ -336,8 +336,10 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
}
}
- nr_gold_pbch(ue);
- ret = nr_pbch_detection(proc, ue, 1, &phy_pdcch_config); // start pbch detection at first symbol after pss
+ if (ret==0) { //we got sss channel
+ nr_gold_pbch(ue);
+ ret = nr_pbch_detection(proc, ue, 1, &phy_pdcch_config); // start pbch detection at first symbol after pss
+ }
if (ret == 0) {
// sync at symbol ue->symbol_offset
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
index dc0f38f096..4491f9dc0f 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h
@@ -1456,16 +1456,6 @@ uint64_t cqi2hex(uint32_t cqi);
uint16_t computeRIV(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs);
-
-/** \brief This routine extracts a single subband PMI from a bitmap coming from UCI or the pmi_extend function
- @param N_RB_DL number of resource blocks
- @param mimo_mode
- @param pmi_alloc subband PMI bitmap
- @param rb resource block for which to extract PMI
- @returns subband PMI
-*/
-uint8_t get_pmi(uint8_t N_RB_DL,MIMO_mode_t mode, uint32_t pmi_alloc,uint16_t rb);
-
int get_nCCE_offset_l1(int *CCE_table,
const unsigned char L,
const int nCCE,
@@ -1567,7 +1557,7 @@ uint8_t get_num_prach_tdd(module_id_t Mod_id);
@param frame_type 0-FDD, 1-TDD
@returns 0-1 accordingly
*/
-uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,lte_frame_type_t frame_type);
+uint8_t get_prach_fmt(uint8_t prach_ConfigIndex,frame_type_t frame_type);
/*!
\brief Helper for MAC, returns frequency index of PRACH resource in TDD for a particular configuration index
@@ -1589,7 +1579,7 @@ void compute_prach_seq(uint16_t rootSequenceIndex,
uint8_t prach_ConfigIndex,
uint8_t zeroCorrelationZoneConfig,
uint8_t highSpeedFlag,
- lte_frame_type_t frame_type,
+ frame_type_t frame_type,
uint32_t X_u[64][839]);
diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
index 7b5019edfe..4086f60f02 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
+++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_ue.h
@@ -181,9 +181,10 @@ typedef struct {
/// Pointers to transport block segments
uint8_t **c;
/// soft bits for each received segment ("d"-sequence)(for definition see 36-212 V8.6 2009-03, p.15)
+ /// Accumulates the soft bits for each round to increase decoding success (HARQ)
int16_t **d;
/// Index of current HARQ round for this DLSCH
- uint8_t round;
+ uint8_t DLround;
/// MCS table for this DLSCH
uint8_t mcs_table;
/// MCS format for this DLSCH
diff --git a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
index 54712cb64e..13ed436273 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/pss_nr.c
@@ -381,7 +381,6 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
int sizePss = LENGTH_PSS_NR * IQ_SIZE; /* complex value i & q signed 16 bits */
int size = ofdm_symbol_size * IQ_SIZE; /* i and q samples signed 16 bits */
int16_t *p = NULL;
- int64_t *q = NULL;
AssertFatal(ofdm_symbol_size > 127, "illegal ofdm_symbol_size %d\n",ofdm_symbol_size);
for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) {
@@ -410,17 +409,6 @@ void init_context_pss_nr(NR_DL_FRAME_PARMS *frame_parms_ue)
assert(0);
}
- size = sizeof(int64_t)*(frame_parms_ue->samples_per_frame + (2*ofdm_symbol_size));
- q = (int64_t*)malloc16(size);
- if (q != NULL) {
- pss_corr_ue[i] = q;
- bzero( pss_corr_ue[i], size);
- }
- else {
- LOG_E(PHY,"Fatal memory allocation problem \n");
- assert(0);
- }
-
generate_pss_nr(frame_parms_ue,i);
}
}
@@ -443,7 +431,6 @@ void free_context_pss_nr(void)
free_and_zero(primary_synchro_nr[i]);
free_and_zero(primary_synchro_nr2[i]);
free_and_zero(primary_synchro_time_nr[i]);
- free_and_zero(pss_corr_ue[i]);
}
}
@@ -801,7 +788,6 @@ static inline double angle64(int64_t x)
*********************************************************************/
#define DOT_PRODUCT_SCALING_SHIFT (17)
-
int pss_search_time_nr(int **rxdata, ///rx data in time domain
NR_DL_FRAME_PARMS *frame_parms,
int fo_flag,
@@ -812,7 +798,7 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
unsigned int n, ar, peak_position, pss_source;
int64_t peak_value;
int64_t result;
- int64_t avg[NUMBER_PSS_SEQUENCE];
+ int64_t avg[NUMBER_PSS_SEQUENCE]={0};
double ffo_est=0;
// performing the correlation on a frame length plus one symbol for the first of the two frame
@@ -823,9 +809,8 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
else
length = frame_parms->samples_per_frame;
- AssertFatal(length>0,"illegal length %d\n",length);
- for (int i = 0; i < NUMBER_PSS_SEQUENCE; i++) AssertFatal(pss_corr_ue[i] != NULL,"pss_corr_ue[%d] not yet allocated! Exiting.\n", i);
+ AssertFatal(length>0,"illegal length %d\n",length);
peak_value = 0;
peak_position = 0;
pss_source = 0;
@@ -846,47 +831,41 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
/* Correlation computation is based on a a dot product which is realized thank to SIMS extensions */
for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) {
- avg[pss_index]=0;
- memset(pss_corr_ue[pss_index],0,length*sizeof(int64_t));
- }
- for (n=0; n < length; n+=4) { //
+ for (n=0; n < length; n+=4) { //
- for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) {
+ int64_t pss_corr_ue=0;
+ /* calculate dot product of primary_synchro_time_nr and rxdata[ar][n]
+ * (ar=0..nb_ant_rx) and store the sum in temp[n]; */
+ for (ar=0; arnb_antennas_rx; ar++) {
- if ( n < (length - frame_parms->ofdm_symbol_size)) {
+ /* perform correlation of rx data and pss sequence ie it is a dot product */
+ result = dot_product64((short*)primary_synchro_time_nr[pss_index],
+ (short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]),
+ frame_parms->ofdm_symbol_size,
+ shift);
+ pss_corr_ue += abs64(result);
+ //((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */
+ //((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */
+ //((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */
+ //((short*)&synchro_out)[1] += ((int*) &result)[1]; /* imaginary part */
- /* calculate dot product of primary_synchro_time_nr and rxdata[ar][n] (ar=0..nb_ant_rx) and store the sum in temp[n]; */
- for (ar=0; arnb_antennas_rx; ar++) {
-
- /* perform correlation of rx data and pss sequence ie it is a dot product */
- result = dot_product64((short*)primary_synchro_time_nr[pss_index],
- (short*)&(rxdata[ar][n+is*frame_parms->samples_per_frame]),
- frame_parms->ofdm_symbol_size,
- shift);
- pss_corr_ue[pss_index][n] += abs64(result);
- //((short*)pss_corr_ue[pss_index])[2*n] += ((short*) &result)[0]; /* real part */
- //((short*)pss_corr_ue[pss_index])[2*n+1] += ((short*) &result)[1]; /* imaginary part */
- //((short*)&synchro_out)[0] += ((int*) &result)[0]; /* real part */
- //((short*)&synchro_out)[1] += ((int*) &result)[1]; /* imaginary part */
-
- }
}
-
+
/* calculate the absolute value of sync_corr[n] */
- avg[pss_index]+=pss_corr_ue[pss_index][n];
- if (pss_corr_ue[pss_index][n] > peak_value) {
- peak_value = pss_corr_ue[pss_index][n];
+ avg[pss_index]+=pss_corr_ue;
+ if (pss_corr_ue > peak_value) {
+ peak_value = pss_corr_ue;
peak_position = n;
pss_source = pss_index;
-
+
#ifdef DEBUG_PSS_NR
- printf("pss_index %d: n %6u peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_ue[pss_index][n]);
+ printf("pss_index %d: n %6u peak_value %15llu\n", pss_index, n, (unsigned long long)pss_corr_ue[n]);
#endif
}
}
}
-
+
if (fo_flag){
// fractional frequency offset computation according to Cross-correlation Synchronization Algorithm Using PSS
@@ -922,7 +901,8 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
// computing absolute value of frequency offset
*f_off = ffo_est*frame_parms->subcarrier_spacing;
- for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++) avg[pss_index]/=(length/4);
+ for (int pss_index = 0; pss_index < NUMBER_PSS_SEQUENCE; pss_index++)
+ avg[pss_index]/=(length/4);
*eNB_id = pss_source;
@@ -937,9 +917,6 @@ int pss_search_time_nr(int **rxdata, ///rx data in time domain
static int debug_cnt = 0;
if (debug_cnt == 0) {
- LOG_M("pss_corr_ue0.m","pss_corr_ue0",pss_corr_ue[0],length,1,6);
- LOG_M("pss_corr_ue1.m","pss_corr_ue1",pss_corr_ue[1],length,1,6);
- LOG_M("pss_corr_ue2.m","pss_corr_ue2",pss_corr_ue[2],length,1,6);
if (is)
LOG_M("rxdata1.m","rxd0",rxdata[frame_parms->samples_per_frame],length,1,1);
else
diff --git a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c
index 88585e6094..ff8d5d42ff 100644
--- a/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c
+++ b/openair1/PHY/NR_UE_TRANSPORT/sss_nr.c
@@ -563,6 +563,10 @@ int rx_sss_nr(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int32_t *tot_metric,
int re = 0;
int im = 0;
+ if (Nid1 == N_ID_1_NUMBER) {
+ LOG_I(PHY,"Failled to detect SSS after PSS\n");
+ return -1;
+ }
d = (int16_t *)&d_sss[Nid2][Nid1];
for(i = 0; i=0,"%s",strerror(errno));
for (int i=0; i
+#include
// This is the formula from Section 5.1.1.1 in 36.213 100*10*log10((2^(MPR*Ks)-1)), where MPR is in the range [0,6] and Ks=1.25
diff --git a/openair1/SCHED/sched_eNB.h b/openair1/SCHED/sched_eNB.h
index de987b0ac7..efdb1bd199 100644
--- a/openair1/SCHED/sched_eNB.h
+++ b/openair1/SCHED/sched_eNB.h
@@ -215,7 +215,7 @@ int16_t get_target_pucch_rx_power(module_id_t module_idP, uint8_t CC_id);
int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx);
-void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);
+void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);
void release_rnti_of_phy(module_id_t mod_id);
/*@}*/
diff --git a/openair1/SCHED_NR_UE/harq_nr.c b/openair1/SCHED_NR_UE/harq_nr.c
index 4afe5f41d3..a9ff01d78a 100644
--- a/openair1/SCHED_NR_UE/harq_nr.c
+++ b/openair1/SCHED_NR_UE/harq_nr.c
@@ -307,7 +307,7 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq)
{
dl_harq->status = SCH_IDLE;
dl_harq->first_rx = 1;
- dl_harq->round = 0;
+ dl_harq->DLround = 0;
dl_harq->DCINdi = 1;
dl_harq->ack = DL_ACKNACK_NO_SET;
}
@@ -334,60 +334,38 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int
if (rnti_type == _SI_RNTI_ ||
rnti_type == _P_RNTI_ ||
rnti_type == _RA_RNTI_) {
- dl_harq->round = 0;
+ dl_harq->DLround = 0;
dl_harq->status = ACTIVE;
dl_harq->first_rx = 1;
- }
- else{
- switch(rv){
- case 0:
- dl_harq->round = 0;
- dl_harq->status = ACTIVE;
- dl_harq->first_rx = 1;
- if (dl_harq->DCINdi == ndi)
- LOG_E(PHY,"Warning! rv %d indicates new transmission but new ndi %d is the same as old ndi %d\n",rv,ndi,dl_harq->DCINdi);
- dl_harq->DCINdi = ndi;
- break;
- case 1:
- dl_harq->round = 3;
- dl_harq->status = ACTIVE;
- dl_harq->first_rx = 0;
- if (dl_harq->DCINdi != ndi) {
- LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv);
- dl_harq->first_rx = 1;
- dl_harq->DCINdi = ndi;
- }
- else if (dl_harq->ack == 1)
- dl_harq->status = SCH_IDLE;
- break;
- case 2:
- dl_harq->round = 1;
- dl_harq->status = ACTIVE;
- dl_harq->first_rx = 0;
- if (dl_harq->DCINdi != ndi) {
- LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv);
- dl_harq->first_rx = 1;
- dl_harq->DCINdi = ndi;
- }
- else if (dl_harq->ack == 1)
- dl_harq->status = SCH_IDLE;
- break;
- case 3:
- dl_harq->round = 2;
- dl_harq->status = ACTIVE;
- dl_harq->first_rx = 0;
- if (dl_harq->DCINdi != ndi) {
- LOG_E(PHY,"Missed previous DCI detections. NDI toggled but rv %d does not correspond to first reception\n",rv);
- dl_harq->first_rx = 1;
- dl_harq->DCINdi = ndi;
- }
- else if (dl_harq->ack == 1)
- dl_harq->status = SCH_IDLE;
- break;
- default:
- AssertFatal(1==0,"Invalid value for rv %d\n",rv);
+ } else {
+ LOG_D(PHY,"receive harq process: %p harqPid=%d, rv=%d, ndi=%d, rntiType=%d new transmission= %s\n",
+ dl_harq, harq_pid, rv, ndi, rnti_type, dl_harq->DCINdi != ndi ? "yes":"no");
+ AssertFatal(rv<4 && rv>=0, "invalid redondancy version %d\n", rv);
+
+ if (ndi!=dl_harq->DCINdi) {
+ if (dl_harq->ack == DL_NACK)
+ LOG_D(PHY,"New transmission on a harq pid (%d) never acknowledged\n", harq_pid);
+ else
+ LOG_D(PHY,"Starting new transmission on a harq pid (%d)\n", harq_pid);
+ } else {
+ if (dl_harq->ack != DL_NACK)
+ LOG_D(PHY,"gNB asked for retransmission even if we sent ACK\n");
+ else
+ LOG_D(PHY,"Starting retransmission on a harq pid (%d), rv (%d)\n", harq_pid, rv);
}
- }
+ if (ndi!=dl_harq->DCINdi) {
+ dl_harq->first_rx = true;
+ dl_harq->DLround = 0;
+ } else {
+ dl_harq->first_rx = false;
+ dl_harq->DLround++;
+ }
+
+ dl_harq->status = ACTIVE;
+
+ dl_harq->DCINdi = ndi;
+ //dl_harq->status = SCH_IDLE;
+ }
}
diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
index ffc62a2040..974e112990 100644
--- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
+++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c
@@ -505,7 +505,7 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
start_meas(&ue->dlsch_rx_pdcch_stats);
/// PDCCH/DCI e-sequence (input to rate matching).
- int32_t pdcch_e_rx_size = 2*4*100*12;
+ int32_t pdcch_e_rx_size = NR_MAX_PDCCH_SIZE;
int16_t pdcch_e_rx[pdcch_e_rx_size];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN);
diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c
index b02f24e04e..aa0ff0db80 100644
--- a/openair1/SCHED_UE/phy_procedures_lte_ue.c
+++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c
@@ -574,7 +574,7 @@ void get_cqipmiri_params(PHY_VARS_UE *ue,
}
}
-PUCCH_FMT_t get_pucch_format(lte_frame_type_t frame_type,
+PUCCH_FMT_t get_pucch_format(frame_type_t frame_type,
lte_prefix_type_t cyclic_prefix_type,
uint8_t SR_payload,
uint8_t nb_cw,
@@ -4870,109 +4870,3 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue,
LOG_D(PHY," ****** end RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx);
return (0);
}
-
-
-void phy_procedures_UE_lte(PHY_VARS_UE *ue,
- UE_rxtx_proc_t *proc,
- uint8_t eNB_id,
- uint8_t abstraction_flag,
- uint8_t do_pdcch_flag,
- runmode_t mode) {
- MessageDef *msg_p;
- int result;
- int frame_rx = proc->frame_rx;
- int frame_tx = proc->frame_tx;
- int subframe_rx = proc->subframe_rx;
- int subframe_tx = proc->subframe_tx;
- UE_L2_STATE_t ret;
- int slot;
-
- if (ue->mac_enabled == 0) {
- ue->UE_mode[eNB_id]=PUSCH;
- }
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,1);
-
- if ( LOG_DEBUGFLAG(UE_TIMING)) {
- start_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]);
- }
- do {
- // Checks if a message has been sent to PHY sub-task
- itti_poll_msg (TASK_PHY_UE, &msg_p);
-
- if (msg_p != NULL) {
- switch (ITTI_MSG_ID(msg_p)) {
- case PHY_FIND_CELL_REQ:
- LOG_I(PHY, "[UE ] Received %s\n", ITTI_MSG_NAME (msg_p));
- /* TODO process the message */
- break;
-
- default:
- LOG_E(PHY, "[UE %ld] Received unexpected message %s\n", ITTI_MSG_DESTINATION_INSTANCE (msg_p), ITTI_MSG_NAME (msg_p));
- break;
- }
-
- result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p);
- AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
- }
- } while(msg_p != NULL);
-
- for (slot=0; slot<2; slot++) {
- if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_UL)||
- (ue->frame_parms.frame_type == FDD)) {
- phy_procedures_UE_TX(ue,proc,eNB_id,abstraction_flag,mode);
- }
-
- if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_DL) ||
- (ue->frame_parms.frame_type == FDD)) {
- phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode);
- }
-
- if ((subframe_select(&ue->frame_parms,subframe_tx)==SF_S) &&
- (slot==1)) {
- phy_procedures_UE_S_TX(ue,eNB_id,abstraction_flag);
- }
-
- if ((subframe_select(&ue->frame_parms,subframe_rx)==SF_S) &&
- (slot==0)) {
- phy_procedures_UE_RX(ue,proc,eNB_id,abstraction_flag,do_pdcch_flag,mode);
- }
-
- if (ue->mac_enabled==1) {
- if (slot==0) {
- //LOG_I(PHY,"[UE %d] Frame %d, subframe %d, star ue_scheduler\n", ue->Mod_id,frame_rx,subframe_tx);
- ret = ue_scheduler(ue->Mod_id,
- frame_rx,
- subframe_rx,
- frame_tx,
- subframe_tx,
- subframe_select(&ue->frame_parms,subframe_tx),
- eNB_id,
- 0/*FIXME CC_id*/);
-
- if (ret == CONNECTION_LOST) {
- LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id,
- frame_rx,subframe_tx);
- ue->UE_mode[eNB_id] = PRACH;
- // mac_xface->macphy_exit("Connection lost");
- } else if (ret == PHY_RESYNCH) {
- LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, trying to resynch\n",
- ue->Mod_id,
- frame_rx,subframe_tx);
- ue->UE_mode[eNB_id] = RESYNCH;
- // mac_xface->macphy_exit("Connection lost");
- } else if (ret == PHY_HO_PRACH) {
- LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n",
- ue->Mod_id,frame_rx,subframe_tx);
- ue->UE_mode[eNB_id] = PRACH;
- }
- }
- }
-
- VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_LTE,0);
-
- if (LOG_DEBUGFLAG(UE_TIMING)) {
- stop_meas(&ue->phy_proc[ue->current_thread_id[subframe_rx]]);
- }
- } // slot
-}
diff --git a/openair1/SCHED_UE/sched_UE.h b/openair1/SCHED_UE/sched_UE.h
index 32702b1148..0dbb779630 100644
--- a/openair1/SCHED_UE/sched_UE.h
+++ b/openair1/SCHED_UE/sched_UE.h
@@ -278,7 +278,7 @@ void dump_dlsch2(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe, unsig
int is_srs_occasion_common(LTE_DL_FRAME_PARMS *frame_parms,int frame_tx,int subframe_tx);
-void compute_srs_pos(lte_frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);
+void compute_srs_pos(frame_type_t frameType,uint16_t isrs,uint16_t *psrsPeriodicity,uint16_t *psrsOffset);
/*@}*/
diff --git a/openair1/SIMULATION/LTE_PHY/pdcchsim.c b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
index bd2c2d66b9..50910290c3 100644
--- a/openair1/SIMULATION/LTE_PHY/pdcchsim.c
+++ b/openair1/SIMULATION/LTE_PHY/pdcchsim.c
@@ -415,7 +415,7 @@ int main(int argc, char **argv) {
uint8_t harq_pid;
uint8_t phich_ACK;
uint8_t num_phich_interf = 0;
- lte_frame_type_t frame_type=TDD;
+ frame_type_t frame_type=TDD;
// int re_offset;
// uint32_t *txptr;
int aarx;
diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c
index d6812dd541..6f747b36a6 100644
--- a/openair1/SIMULATION/NR_PHY/dlschsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlschsim.c
@@ -478,14 +478,11 @@ int main(int argc, char **argv)
harq_process->n_dmrs_cdm_groups = 1;
printf("harq process ue mcs = %d Qm = %d, symb %d\n", harq_process->mcs, harq_process->Qm, nb_symb_sch);
- unsigned char *test_input;
- test_input = (unsigned char *) malloc16(sizeof(unsigned char) * TBS / 8);
+ unsigned char *test_input=dlsch->harq_process.pdu;
//unsigned char test_input[TBS / 8] __attribute__ ((aligned(16)));
for (i = 0; i < TBS / 8; i++)
test_input[i] = (unsigned char) rand();
- //estimated_output = harq_process->b;
-
#ifdef DEBUG_NR_DLSCHSIM
for (i = 0; i < TBS / 8; i++) printf("test_input[i]=%hhu \n",test_input[i]);
#endif
@@ -498,7 +495,7 @@ int main(int argc, char **argv)
unsigned char output[rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS] __attribute__((aligned(32)));
bzero(output,rel15->rbSize * NR_SYMBOLS_PER_SLOT * NR_NB_SC_PER_RB * 8 * NR_MAX_NB_LAYERS);
if (input_fd == NULL) {
- nr_dlsch_encoding(gNB, test_input, frame, slot, dlsch, frame_parms,output,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+ nr_dlsch_encoding(gNB, frame, slot, &dlsch->harq_process, frame_parms,output,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
}
for (SNR = snr0; SNR < snr1; SNR += snr_step) {
@@ -618,8 +615,6 @@ int main(int argc, char **argv)
}
}*/
- free(test_input);
-
free_channel_desc_scm(gNB2UE);
reset_DLSCH_struct(gNB, &msgDataTx);
diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c
index 1de8d6ced4..00262149c9 100644
--- a/openair1/SIMULATION/NR_PHY/dlsim.c
+++ b/openair1/SIMULATION/NR_PHY/dlsim.c
@@ -1089,7 +1089,7 @@ int main(int argc, char **argv)
UE_harq_process->ack = 0;
round = 0;
- UE_harq_process->round = round;
+ UE_harq_process->DLround = round;
UE_harq_process->first_rx = 1;
while ((roundack==0)) {
diff --git a/openair1/SIMULATION/NR_PHY/pucchsim.c b/openair1/SIMULATION/NR_PHY/pucchsim.c
index 151d51d726..b6dc3d8f11 100644
--- a/openair1/SIMULATION/NR_PHY/pucchsim.c
+++ b/openair1/SIMULATION/NR_PHY/pucchsim.c
@@ -551,7 +551,7 @@ int main(int argc, char **argv)
if (n_trials==1) printf("txlev %d (%f dB), offset %d, sigma2 %f ( %f dB)\n",txlev,10*log10(txlev),startingSymbolIndex*frame_parms->ofdm_symbol_size,sigma2,sigma2_dB);
- struct complex16 **rxdataF = (struct complex16 **)gNB->common_vars.rxdataF;
+ c16_t **rxdataF = (struct complex16 **)gNB->common_vars.rxdataF;
for (int symb=0; symbframe_parms.symbols_per_slot;symb++) {
if (symb= startingSymbolIndex+nrofSymbols) {
int i0 = symb*gNB->frame_parms.ofdm_symbol_size;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c
index c88c261667..093bb2d000 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c
@@ -285,7 +285,7 @@ int main(int argc, char *argv[])
uint8_t nb_antennas_tx = 1;
uint8_t nb_antennas_rx = 1;
uint8_t frame_type = FDD;
- uint8_t N_RB_DL=100;
+ int N_RB_DL=100;
lte_prefix_type_t extended_prefix_flag = NORMAL;
int Nid_cell[] = {(3*0+0)};
VOID_PARAMETER argc;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c
index 05170e0bc9..96d7382f2b 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c
@@ -200,7 +200,7 @@ int main(int argc, char *argv[])
uint8_t nb_antennas_tx = 1;
uint8_t nb_antennas_rx = 1;
uint8_t frame_type = FDD;
- uint8_t N_RB_DL=100;
+ int N_RB_DL=100;
lte_prefix_type_t extended_prefix_flag = NORMAL;
int Nid_cell[] = {(3*0+0)};
VOID_PARAMETER argc;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c
index 7600dfb08f..5c7f3157e7 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c
@@ -379,7 +379,7 @@ int main(int argc, char *argv[])
uint8_t nb_antennas_tx = 1;
uint8_t nb_antennas_rx = 1;
uint8_t frame_type = FDD;
- uint8_t N_RB_DL=100;
+ int N_RB_DL=100;
lte_prefix_type_t extended_prefix_flag = NORMAL;
int decoded_pbch = -1;
int Nid1, Nid2;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c
index 2088d558cb..de1249457f 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c
@@ -184,7 +184,7 @@ int main(int argc, char *argv[])
uint8_t nb_antennas_rx = 1;
uint16_t Nid_cell=123;
uint8_t frame_type=FDD;
- uint8_t N_RB_DL=100;
+ int N_RB_DL=100;
lte_prefix_type_t extended_prefix_flag=NORMAL;
const char *name_test = "PSS NR";
test_t test = { name_test, 0, 0, 0, 0};
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
index 4334bd12f9..2302c50ab1 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
@@ -206,7 +206,7 @@ void undefined_function(const char *function) {
*********************************************************************/
int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission_mode,
- unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, uint8_t N_RB_DL) {
+ unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell, int N_RB_DL) {
(void) transmission_mode;
NR_DL_FRAME_PARMS *frame_parms;
int log_level = OAILOG_TRACE;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h
index f0929e88c0..78efc2234b 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h
@@ -90,7 +90,7 @@ int set_pss_in_rx_buffer(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int p
int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission_mode,
unsigned char extended_prefix_flag, uint8_t frame_type, uint16_t Nid_cell,
- uint8_t N_RB_DL);
+ int N_RB_DL);
void display_test_configuration_pss(int position, int pss_sequence_number);
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c
index 68acea6d98..4948d0a876 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_generator_test.c
@@ -142,7 +142,7 @@ int main(int argc, char *argv[]) {
uint8_t nb_antennas_tx = 1;
uint8_t nb_antennas_rx = 1;
uint8_t frame_type = FDD;
- uint8_t N_RB_DL=106;
+ int N_RB_DL=106;
lte_prefix_type_t extended_prefix_flag = NORMAL;
int Nid_cell[] = {(3*1+3)};
VOID_PARAMETER argc;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c
index f731edc20a..31fe15a6de 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c
@@ -1239,7 +1239,7 @@ int main(int argc, char *argv[])
uint8_t nb_antennas_tx = 1;
uint8_t nb_antennas_rx = 1;
uint8_t frame_type = FDD;
- uint8_t N_RB_DL=100;
+ int N_RB_DL=100;
lte_prefix_type_t extended_prefix_flag = NORMAL;
int Nid_cell[] = {(3*1+3)};
VOID_PARAMETER argc;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c
index 34ea68bc61..235387acf7 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c
@@ -442,7 +442,7 @@ int main(int argc, char *argv[])
uint8_t nb_antennas_tx = 1;
uint8_t nb_antennas_rx = 1;
uint8_t frame_type = FDD;
- uint8_t N_RB_DL=100;
+ int N_RB_DL=100;
lte_prefix_type_t extended_prefix_flag = NORMAL;
int Nid_cell[] = {(3*0+0)};
VOID_PARAMETER argc;
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c
index 34127b604f..6f6594861a 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c
@@ -181,7 +181,7 @@ int main(int argc, char *argv[])
uint8_t nb_antennas_tx = 1;
uint8_t nb_antennas_rx = 1;
uint8_t frame_type = FDD;
- uint8_t N_RB_DL=100;
+ int N_RB_DL=100;
lte_prefix_type_t extended_prefix_flag = NORMAL;
int phase;
int Nid1, Nid2;
diff --git a/openair2/COMMON/m2ap_messages_types.h b/openair2/COMMON/m2ap_messages_types.h
index c70c50fc64..460dbfc4bb 100644
--- a/openair2/COMMON/m2ap_messages_types.h
+++ b/openair2/COMMON/m2ap_messages_types.h
@@ -354,7 +354,7 @@ typedef struct m2ap_register_mce_req_s {
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
int num_cc;
@@ -427,7 +427,7 @@ typedef struct m2ap_register_enb_req_s {
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
int num_cc;
diff --git a/openair2/COMMON/m3ap_messages_types.h b/openair2/COMMON/m3ap_messages_types.h
index 21e24dd449..36ac8fcc9a 100644
--- a/openair2/COMMON/m3ap_messages_types.h
+++ b/openair2/COMMON/m3ap_messages_types.h
@@ -123,7 +123,7 @@ typedef struct m3ap_register_mce_req_s {
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
int num_cc;
diff --git a/openair2/COMMON/phy_messages_types.h b/openair2/COMMON/phy_messages_types.h
index 1f040a0a77..40e4678228 100644
--- a/openair2/COMMON/phy_messages_types.h
+++ b/openair2/COMMON/phy_messages_types.h
@@ -70,7 +70,7 @@ typedef struct CellInfo_s {
//-------------------------------------------------------------------------------------------//
// eNB: ENB_APP -> PHY messages
typedef struct PhyConfigurationReq_s {
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
lte_prefix_type_t prefix_type[MAX_NUM_CCs];
uint32_t downlink_frequency[MAX_NUM_CCs];
int32_t uplink_frequency_offset[MAX_NUM_CCs];
diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h
index ac70dee092..5b214cf95a 100644
--- a/openair2/COMMON/rrc_messages_types.h
+++ b/openair2/COMMON/rrc_messages_types.h
@@ -188,7 +188,7 @@ typedef struct RrcConfigurationReq_s {
uint32_t rrc_inactivity_timer_thres; // for testing, maybe change later
paging_drx_t default_drx;
int16_t nb_cc;
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint8_t tdd_config[MAX_NUM_CCs];
uint8_t tdd_config_s[MAX_NUM_CCs];
lte_prefix_type_t prefix_type[MAX_NUM_CCs];
@@ -339,7 +339,7 @@ typedef struct NbIoTRrcConfigurationReq_s {
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
- lte_frame_type_t frame_type;
+ frame_type_t frame_type;
uint8_t tdd_config;
uint8_t tdd_config_s;
lte_prefix_type_t prefix_type;
diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h
index 9339ab12f3..cd092b6ca8 100644
--- a/openair2/COMMON/x2ap_messages_types.h
+++ b/openair2/COMMON/x2ap_messages_types.h
@@ -138,7 +138,7 @@ typedef struct x2ap_register_enb_req_s {
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
uint32_t subframeAssignment[MAX_NUM_CCs];
diff --git a/openair2/ENB_APP/RRC_config_tools.h b/openair2/ENB_APP/RRC_config_tools.h
index 488441ff59..89cefeaa1f 100644
--- a/openair2/ENB_APP/RRC_config_tools.h
+++ b/openair2/ENB_APP/RRC_config_tools.h
@@ -38,7 +38,7 @@ typedef struct eutra_band_s {
uint32_t ul_max;
uint32_t dl_min;
uint32_t dl_max;
- lte_frame_type_t frame_type;
+ frame_type_t frame_type;
} eutra_band_t;
diff --git a/openair2/ENB_APP/flexran_agent_ran_api.c b/openair2/ENB_APP/flexran_agent_ran_api.c
index 68d1f3311f..9926ec9e20 100644
--- a/openair2/ENB_APP/flexran_agent_ran_api.c
+++ b/openair2/ENB_APP/flexran_agent_ran_api.c
@@ -1352,7 +1352,7 @@ void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t
}
}
-void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type) {
+void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, frame_type_t frame_type) {
if (phy_is_present(mod_id, cc_id)) {
RC.eNB[mod_id][cc_id]->frame_parms.frame_type = frame_type;
} else {
diff --git a/openair2/ENB_APP/flexran_agent_ran_api.h b/openair2/ENB_APP/flexran_agent_ran_api.h
index 79115b0a16..c15865ccfd 100644
--- a/openair2/ENB_APP/flexran_agent_ran_api.h
+++ b/openair2/ENB_APP/flexran_agent_ran_api.h
@@ -433,7 +433,7 @@ void flexran_agent_set_operating_eutra_band(mid_t mod_id, uint8_t cc_id, uint8_t
void flexran_agent_set_operating_bandwidth(mid_t mod_id, uint8_t cc_id, uint8_t N_RB);
/*set frame type*/
-void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, lte_frame_type_t frame_type);
+void flexran_agent_set_operating_frame_type(mid_t mod_id, uint8_t cc_id, frame_type_t frame_type);
/*RRC status flexRAN*/
uint8_t flexran_get_rrc_status(mid_t mod_id, rnti_t rnti);
diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c
index 434a2896de..2c486ec832 100644
--- a/openair2/GNB_APP/gnb_config.c
+++ b/openair2/GNB_APP/gnb_config.c
@@ -346,7 +346,7 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) {
// prepare DL Allocation lists
nr_rrc_config_dl_tda(scc);
- lte_frame_type_t frame_type = get_frame_type((int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
+ frame_type_t frame_type = get_frame_type((int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
if (frame_type == FDD) {
ASN_STRUCT_FREE(asn_DEF_NR_TDD_UL_DL_ConfigCommon, scc->tdd_UL_DL_ConfigurationCommon);
scc->tdd_UL_DL_ConfigurationCommon = NULL;
diff --git a/openair2/LAYER2/MAC/config.c b/openair2/LAYER2/MAC/config.c
index 209275acb3..d22485d23f 100644
--- a/openair2/LAYER2/MAC/config.c
+++ b/openair2/LAYER2/MAC/config.c
@@ -58,11 +58,6 @@ extern int l2_init_eNB(void);
extern void mac_top_init_eNB(void);
extern void mac_init_cell_params(int Mod_idP,int CC_idP);
-
-int32_t **rxdata;
-int32_t **txdata;
-
-
typedef struct eutra_bandentry_s {
int16_t band;
uint32_t ul_min;
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
index 9dd03ddcf6..9123afd324 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac.h
@@ -107,11 +107,10 @@ typedef struct {
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_SHORT;
typedef struct {
- uint8_t LCID: 6; // octet 1 [5:0]
- uint8_t F: 1; // octet 1 [6]
- uint8_t R: 1; // octet 1 [7]
- uint8_t L1: 8; // octet 2 [7:0]
- uint8_t L2: 8; // octet 3 [7:0]
+ uint8_t LCID: 6;
+ uint8_t F: 1;
+ uint8_t R: 1;
+ uint16_t L: 16;
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_LONG;
typedef struct {
@@ -119,6 +118,23 @@ typedef struct {
uint8_t R: 2; // octet 1 [7:6]
} __attribute__ ((__packed__)) NR_MAC_SUBHEADER_FIXED;
+static inline int get_mac_len(uint8_t* pdu, int pdu_len, uint16_t *mac_ce_len, uint16_t *mac_subheader_len) {
+ if ( pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
+ return false;
+ NR_MAC_SUBHEADER_SHORT *s = (NR_MAC_SUBHEADER_SHORT*) pdu;
+ NR_MAC_SUBHEADER_LONG *l = (NR_MAC_SUBHEADER_LONG*) pdu;
+ if (s->F && pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
+ return false;
+ if (s->F) {
+ *mac_subheader_len = sizeof(*l);
+ *mac_ce_len = ntohs(l->L);
+ } else {
+ *mac_subheader_len = sizeof(*s);
+ *mac_ce_len = s->L;
+ }
+ return true;
+}
+
// BSR MAC CEs
// TS 38.321 ch. 6.1.3.1
// Short BSR for a specific logical channel group ID
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
index b25efbb5d8..581930b83d 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c
@@ -3092,7 +3092,7 @@ int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slo
else return(slot_in_period <= slots1+tdd_UL_DL_ConfigurationCommon->pattern2->nrofDownlinkSlots ? 1 : 0);
}
-int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slot, lte_frame_type_t frame_type) {
+int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slot, frame_type_t frame_type) {
int period,period1,period2=0;
diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
index 0f2cb42b88..e8a3af2498 100644
--- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
+++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h
@@ -45,7 +45,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
int is_nr_DL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon,slot_t slotP);
-int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, lte_frame_type_t frame_type);
+int is_nr_UL_slot(NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, slot_t slotP, frame_type_t frame_type);
uint16_t nr_dci_size(const NR_BWP_DownlinkCommon_t *initialDLBWP,
const NR_BWP_UplinkCommon_t *initialULBWP,
diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c
index 3b10167e03..bd693e4d88 100644
--- a/openair2/LAYER2/NR_MAC_UE/config_ue.c
+++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c
@@ -323,7 +323,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
mac->frequency_range = band<100?FR1:FR2;
- lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
+ frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
// cell config
diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
index fc2c2d2c8b..99cbdf3292 100644
--- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h
+++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h
@@ -369,7 +369,7 @@ typedef struct {
NR_ControlResourceSet_t *coreset[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP];
NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_SS];
- lte_frame_type_t frame_type;
+ frame_type_t frame_type;
/*BWP*/
// dedicated active DL BWP
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
index fe642e566e..79ebaea70a 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
@@ -2137,6 +2137,7 @@ uint8_t get_downlink_ack(NR_UE_MAC_INST_t *mac,
pucch->is_common = current_harq->is_common;
current_harq->active = false;
current_harq->ack_received = false;
+ LOG_D(PHY,"%4d.%2d Sent %d ack on harq pid %d\n", frame, slot, current_harq->ack, dl_harq_pid);
}
}
}
@@ -3370,10 +3371,6 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
NR_UL_TIME_ALIGNMENT_t *ul_time_alignment,
int pdu_id){
- uint8_t rx_lcid;
- uint16_t mac_ce_len;
- uint16_t mac_subheader_len;
- uint16_t mac_sdu_len;
module_id_t module_idP = dl_info->module_id;
frame_t frameP = dl_info->frame;
int slot = dl_info->slot;
@@ -3392,139 +3389,100 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
LOG_D(MAC, "In %s [%d.%d]: processing PDU %d (with length %d) of %d total number of PDUs...\n", __FUNCTION__, frameP, slot, pdu_id, pdu_len, dl_info->rx_ind->number_pdus);
while (!done && pdu_len > 0){
- mac_ce_len = 0x0000;
- mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct
- mac_sdu_len = 0x0000;
- rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
+ uint16_t mac_len = 0x0000;
+ uint16_t mac_subheader_len = 0x0001; // default to fixed-length subheader = 1-oct
+ uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
LOG_D(MAC, "[UE] LCID %d, PDU length %d\n", rx_lcid, pdu_len);
+ bool ret;
switch(rx_lcid){
// MAC CE
case DL_SCH_LCID_CCCH:
// MSG4 RRC Setup 38.331
// variable length
- if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
- mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8)
- | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff);
- mac_subheader_len = 3;
- } else {
- mac_sdu_len = ((NR_MAC_SUBHEADER_SHORT *) pduP)->L;
- mac_subheader_len = 2;
- }
-
- AssertFatal(pdu_len > mac_sdu_len, "The mac_sdu_len (%d) has an invalid size. PDU len = %d! \n",
- mac_sdu_len, pdu_len);
+ ret=get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len);
+ AssertFatal(ret, "The mac_len (%d) has an invalid size. PDU len = %d! \n",
+ mac_len, pdu_len);
// Check if it is a valid CCCH message, we get all 00's messages very often
int i = 0;
- for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) {
+ for(i=0; i<(mac_subheader_len+mac_len); i++) {
if(pduP[i] != 0) {
break;
}
}
- if (i == (mac_subheader_len+mac_sdu_len)) {
+ if (i == (mac_subheader_len+mac_len)) {
LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len);
done = 1;
break;
}
- if ( mac_sdu_len > 0 ) {
- LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_sdu_len);
+ if ( mac_len > 0 ) {
+ LOG_D(NR_MAC,"DL_SCH_LCID_CCCH (e.g. RRCSetup) with payload len %d\n", mac_len);
for (int i = 0; i < mac_subheader_len; i++) {
LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]);
}
- for (int i = 0; i < mac_sdu_len; i++) {
+ for (int i = 0; i < mac_len; i++) {
LOG_D(NR_MAC, "%d: 0x%x\n", i, pduP[mac_subheader_len + i]);
}
- nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_sdu_len);
+ nr_mac_rrc_data_ind_ue(module_idP, CC_id, gNB_index, frameP, 0, mac->crnti, CCCH, pduP+mac_subheader_len, mac_len);
}
break;
case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH:
+ case DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL:
+ case DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT:
+ case DL_SCH_LCID_SP_SRS_ACTIVATION:
// 38.321 Ch6.1.3.14
// varialbe length
- mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
- mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- mac_subheader_len = 3;
- }
- break;
- case DL_SCH_LCID_APERIODIC_CSI_TRI_STATE_SUBSEL:
- // 38.321 Ch6.1.3.13
- // varialbe length
- mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
- mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- mac_subheader_len = 3;
- }
- break;
- case DL_SCH_LCID_SP_CSI_RS_CSI_IM_RES_SET_ACT:
- // 38.321 Ch6.1.3.12
- // varialbe length
- mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
- mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- mac_subheader_len = 3;
- }
- break;
- case DL_SCH_LCID_SP_SRS_ACTIVATION:
- // 38.321 Ch6.1.3.17
- // varialbe length
- mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
- mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- mac_subheader_len = 3;
- }
+ get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len);
break;
+
case DL_SCH_LCID_RECOMMENDED_BITRATE:
// 38.321 Ch6.1.3.20
- mac_ce_len = 2;
+ mac_len = 2;
break;
case DL_SCH_LCID_SP_ZP_CSI_RS_RES_SET_ACT:
// 38.321 Ch6.1.3.19
- mac_ce_len = 2;
+ mac_len = 2;
break;
case DL_SCH_LCID_PUCCH_SPATIAL_RELATION_ACT:
// 38.321 Ch6.1.3.18
- mac_ce_len = 3;
+ mac_len = 3;
break;
case DL_SCH_LCID_SP_CSI_REP_PUCCH_ACT:
// 38.321 Ch6.1.3.16
- mac_ce_len = 2;
+ mac_len = 2;
break;
case DL_SCH_LCID_TCI_STATE_IND_UE_SPEC_PDCCH:
// 38.321 Ch6.1.3.15
- mac_ce_len = 2;
+ mac_len = 2;
break;
case DL_SCH_LCID_DUPLICATION_ACT:
// 38.321 Ch6.1.3.11
- mac_ce_len = 1;
+ mac_len = 1;
break;
case DL_SCH_LCID_SCell_ACT_4_OCT:
// 38.321 Ch6.1.3.10
- mac_ce_len = 4;
+ mac_len = 4;
break;
case DL_SCH_LCID_SCell_ACT_1_OCT:
// 38.321 Ch6.1.3.10
- mac_ce_len = 1;
+ mac_len = 1;
break;
case DL_SCH_LCID_L_DRX:
// 38.321 Ch6.1.3.6
// fixed length but not yet specify.
- mac_ce_len = 0;
+ mac_len = 0;
break;
case DL_SCH_LCID_DRX:
// 38.321 Ch6.1.3.5
// fixed length but not yet specify.
- mac_ce_len = 0;
+ mac_len = 0;
break;
case DL_SCH_LCID_TA_COMMAND:
// 38.321 Ch6.1.3.4
- mac_ce_len = 1;
+ mac_len = 1;
/*uint8_t ta_command = ((NR_MAC_CE_TA *)pduP)[1].TA_COMMAND;
uint8_t tag_id = ((NR_MAC_CE_TA *)pduP)[1].TAGID;*/
@@ -3546,14 +3504,14 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
// Clause 5.1.5 and 6.1.3.3 of 3GPP TS 38.321 version 16.2.1 Release 16
// MAC Header: 1 byte (R/R/LCID)
// MAC SDU: 6 bytes (UE Contention Resolution Identity)
- mac_ce_len = 6;
+ mac_len = 6;
if(ra->ra_state == WAIT_CONTENTION_RESOLUTION) {
LOG_I(MAC, "[UE %d][RAPROC] Frame %d : received contention resolution identity: 0x%02x%02x%02x%02x%02x%02x Terminating RA procedure\n",
module_idP, frameP, pduP[1], pduP[2], pduP[3], pduP[4], pduP[5], pduP[6]);
bool ra_success = true;
- for(int i = 0; icont_res_id[i] != pduP[i+1]) {
ra_success = false;
break;
@@ -3581,25 +3539,9 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
// check if LCID is valid at current time.
default:
{
- // check if LCID is valid at current time.
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
- return;
- NR_MAC_SUBHEADER_SHORT *shs = (NR_MAC_SUBHEADER_SHORT *)pduP;
- if (shs->F) {
- //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- mac_subheader_len = 3;
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
- return;
- NR_MAC_SUBHEADER_LONG *shl = (NR_MAC_SUBHEADER_LONG *)pduP;
- mac_sdu_len = ((uint16_t)(shl->L1 & 0x7f) << 8) | (uint16_t)(shl->L2 & 0xff);
- } else {
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
- return;
- mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- }
-
- LOG_D(NR_MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_sdu_len);
+ if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
+ return;
+ LOG_D(NR_MAC, "[UE %d] %4d.%2d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, slot, rx_lcid, gNB_index, mac_len);
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP);
@@ -3620,7 +3562,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
MBMS_FLAG_NO,
rx_lcid,
(char *) (pduP + mac_subheader_len),
- mac_sdu_len,
+ mac_len,
1,
NULL);
} else {
@@ -3631,8 +3573,8 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
break;
}
}
- pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
- pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
+ pduP += ( mac_subheader_len + mac_len );
+ pdu_len -= ( mac_subheader_len + mac_len );
if (pdu_len < 0)
LOG_E(MAC, "[UE %d][%d.%d] nr_ue_process_mac_pdu, residual mac pdu length %d < 0!\n", module_idP, frameP, slot, pdu_len);
}
diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
index 8f61d66333..0afad893d7 100644
--- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
+++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
@@ -3143,8 +3143,7 @@ uint8_t nr_ue_get_sdu(module_id_t module_idP,
header->R = 0;
header->F = 1;
header->LCID = lcid;
- header->L1 = ((unsigned short) sdu_length >> 8) & 0x7f;
- header->L2 = (unsigned short) sdu_length & 0xff;
+ header->L = htons(sdu_length);
#ifdef ENABLE_MAC_PAYLOAD_DEBUG
LOG_I(NR_MAC, "In %s: dumping MAC sub-header with length %d: \n", __FUNCTION__, sh_size);
diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c
index 6ba8629718..a2cbd4807f 100644
--- a/openair2/LAYER2/NR_MAC_gNB/config.c
+++ b/openair2/LAYER2/NR_MAC_gNB/config.c
@@ -233,7 +233,7 @@ void config_common(int Mod_idP, int ssb_SubcarrierOffset, rrc_pdsch_AntennaPorts
uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
frequency_range_t frequency_range = band<100?FR1:FR2;
- lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
+ frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
RC.nrmac[Mod_idP]->common_channels[0].frame_type = frame_type;
// Cell configuration
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
index ca197b224d..9a651293b2 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
@@ -399,7 +399,7 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot,
uint16_t *msg2_frame, uint16_t *msg2_slot,
NR_ServingCellConfigCommon_t *scc,
- lte_frame_type_t frame_type,
+ frame_type_t frame_type,
uint16_t monitoring_slot_period,
uint16_t monitoring_offset,uint8_t beam_index,
uint8_t num_active_ssb,
@@ -525,7 +525,7 @@ void nr_initiate_ra_proc(module_id_t module_idP,
gNB_MAC_INST *nr_mac = RC.nrmac[module_idP];
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
- lte_frame_type_t frame_type = cc->frame_type;
+ frame_type_t frame_type = cc->frame_type;
uint8_t total_RApreambles = MAX_NUM_NR_PRACH_PREAMBLES;
uint8_t num_ssb_per_RO = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present;
@@ -933,7 +933,7 @@ void nr_get_Msg3alloc(module_id_t module_id,
uint16_t msg3_nb_rb = 8; // sdu has 6 or 8 bytes
- lte_frame_type_t frame_type = RC.nrmac[module_id]->common_channels->frame_type;
+ frame_type_t frame_type = RC.nrmac[module_id]->common_channels->frame_type;
int mu = ubwp ?
ubwp->bwp_Common->genericParameters.subcarrierSpacing :
@@ -1622,7 +1622,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
harq->feedback_slot = pucch->ul_slot;
harq->feedback_frame = pucch->frame;
- uint8_t *buf = (uint8_t *) harq->tb;
+ uint8_t *buf = (uint8_t *) harq->transportBlock;
// Bytes to be transmitted
if (harq->round == 0) {
if (ra->msg3_dcch_dtch) {
@@ -1870,11 +1870,11 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
}
T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), T_INT(ra->rnti),
- T_INT(frameP), T_INT(slotP), T_INT(current_harq_pid), T_BUFFER(harq->tb, harq->tb_size));
+ T_INT(frameP), T_INT(slotP), T_INT(current_harq_pid), T_BUFFER(harq->transportBlock, harq->tb_size));
// DL TX request
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
- memcpy(tx_req->TLVs[0].value.direct, harq->tb, sizeof(uint8_t) * harq->tb_size);
+ memcpy(tx_req->TLVs[0].value.direct, harq->transportBlock, sizeof(uint8_t) * harq->tb_size);
tx_req->PDU_length = harq->tb_size;
tx_req->PDU_index = pduindex;
tx_req->num_TLV = 1;
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
index 5aace1d0dc..53485886c0 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c
@@ -53,39 +53,39 @@
#define WORD 32
//#define SIZE_OF_POINTER sizeof (void *)
-void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp)
-{
+void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *bwp) {
gNB_MAC_INST *nrmac = RC.nrmac[module_id];
const int bwp_id = bwp ? bwp->bwp_Id : 0;
+
if (nrmac->preferred_dl_tda[bwp_id])
return;
/* there is a mixed slot only when in TDD */
NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon;
- lte_frame_type_t frame_type = nrmac->common_channels->frame_type;
+ frame_type_t frame_type = nrmac->common_channels->frame_type;
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
const NR_TDD_UL_DL_Pattern_t *tdd =
- scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
-
+ scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL;
int symb_dlMixed = 0;
int nr_mix_slots = 0;
int nr_slots_period = n;
+
if (tdd) {
symb_dlMixed = (1 << tdd->nrofDownlinkSymbols) - 1;
nr_mix_slots = tdd->nrofDownlinkSymbols != 0 || tdd->nrofUplinkSymbols != 0;
nr_slots_period /= get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity);
- }
- else
+ } else
// if TDD configuration is not present and the band is not FDD, it means it is a dynamic TDD configuration
AssertFatal(nrmac->common_channels->frame_type == FDD,"Dynamic TDD not handled yet\n");
int target_ss;
+
if (bwp) {
target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
- }
- else {
+ } else {
target_ss = NR_SearchSpace__searchSpaceType_PR_common;
}
+
const NR_SIB1_t *sib1 = nrmac->common_channels[0].sib1 ? nrmac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
NR_SearchSpace_t *search_space = get_searchspace(sib1,
scc,
@@ -113,9 +113,9 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *
// here we assume that the coreset is scheduled every slot (which it
// currently is) and starting at symbol 0
AssertFatal((symb_coreset & symb_tda) == 0, "TDA index 0 for DL overlaps with CORESET\n");
-
/* check that TDA index 1 fits into DL part of mixed slot, if it exists */
int tdaMi = -1;
+
if (frame_type == TDD && tdaList->list.count > 1) {
const NR_PDSCH_TimeDomainResourceAllocation_t *tdaP_Mi = tdaList->list.array[1];
AssertFatal(!tdaP_Mi->k0 || *tdaP_Mi->k0 == 0,
@@ -124,6 +124,7 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *
int start, len;
SLIV2SL(tdaP_Mi->startSymbolAndLength, &start, &len);
const uint16_t symb_tda = ((1 << len) - 1) << start;
+
// check whether coreset and TDA overlap: then, we cannot use it. Also,
// check whether TDA is entirely within mixed slot DL. Note that
// here we assume that the coreset is scheduled every slot (which it
@@ -143,10 +144,12 @@ void calculate_preferred_dl_tda(module_id_t module_id, const NR_BWP_Downlink_t *
for (int i = 0; i < n; ++i) {
nrmac->preferred_dl_tda[bwp_id][i] = -1;
+
if (frame_type == FDD || i % nr_slots_period < tdd->nrofDownlinkSlots)
nrmac->preferred_dl_tda[bwp_id][i] = 0;
else if (nr_mix_slots && i % nr_slots_period == tdd->nrofDownlinkSlots)
nrmac->preferred_dl_tda[bwp_id][i] = tdaMi;
+
LOG_D(MAC, "slot %d preferred_dl_tda %d\n", i, nrmac->preferred_dl_tda[bwp_id][i]);
}
}
@@ -157,8 +160,7 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
const NR_UE_sched_ctrl_t *ue_sched_ctl,
unsigned char *mac_pdu,
unsigned char drx_cmd,
- unsigned char *ue_cont_res_id)
-{
+ unsigned char *ue_cont_res_id) {
gNB_MAC_INST *gNB = RC.nrmac[module_idP];
NR_MAC_SUBHEADER_FIXED *mac_pdu_ptr = (NR_MAC_SUBHEADER_FIXED *) mac_pdu;
uint8_t last_size = 0;
@@ -201,8 +203,6 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
memcpy((void *) mac_pdu_ptr, (void *) ce_ptr, mac_ce_size);
ce_ptr += mac_ce_size;
mac_pdu_ptr += (unsigned char) mac_ce_size;
-
-
}
// Contention resolution fixed subheader and MAC CE
@@ -399,18 +399,18 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
#define BLER_UPDATE_FRAME 10
#define BLER_FILTER 0.9f
-int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t slot, int UE_id, int mcs_table)
-{
+int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t slot, int UE_id, int mcs_table) {
gNB_MAC_INST *nrmac = RC.nrmac[mod_id];
const NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon;
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
-
int max_allowed_mcs = (mcs_table == 1) ? 27 : 28;
int max_mcs = nrmac->dl_max_mcs;
+
if (nrmac->dl_max_mcs>max_allowed_mcs)
max_mcs = max_allowed_mcs;
NR_DL_bler_stats_t *bler_stats = &nrmac->UE_info.UE_sched_ctrl[UE_id].dl_bler_stats;
+
/* first call: everything is zero. Initialize to sensible default */
if (bler_stats->last_frame_slot == 0 && bler_stats->mcs == 0) {
bler_stats->last_frame_slot = frame * n + slot;
@@ -418,13 +418,16 @@ int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t
bler_stats->bler = (nrmac->dl_bler_target_lower + nrmac->dl_bler_target_upper) / 2;
bler_stats->rd2_bler = nrmac->dl_rd2_bler_threshold;
}
+
const int now = frame * n + slot;
int diff = now - bler_stats->last_frame_slot;
+
if (diff < 0) // wrap around
diff += 1024 * n;
const uint8_t old_mcs = bler_stats->mcs;
const NR_mac_stats_t *stats = &nrmac->UE_info.mac_stats[UE_id];
+
// TODO put back this condition when relevant
/*const int dret3x = stats->dlsch_rounds[3] - bler_stats->dlsch_rounds[3];
if (dret3x > 0) {
@@ -447,8 +450,8 @@ int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t
const float rd2_bler_wnd = dtx > 0 ? (float) dretx2 / dtx : bler_stats->rd2_bler;
bler_stats->bler = BLER_FILTER * bler_stats->bler + (1 - BLER_FILTER) * bler_window;
bler_stats->rd2_bler = BLER_FILTER / 4 * bler_stats->rd2_bler + (1 - BLER_FILTER / 4) * rd2_bler_wnd;
-
int new_mcs = old_mcs;
+
// TODO put back this condition when relevant
/* first ensure that number of 2nd retx is below threshold. If this is the
* case, use 1st retx to adjust faster
@@ -459,9 +462,8 @@ int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t
new_mcs += 1;
else if (bler_stats->bler > nrmac->dl_bler_target_upper && old_mcs > 6)
new_mcs -= 1;
+
// else we are within threshold boundaries
-
-
bler_stats->last_frame_slot = now;
bler_stats->mcs = new_mcs;
memcpy(bler_stats->dlsch_rounds, stats->dlsch_rounds, sizeof(stats->dlsch_rounds));
@@ -473,11 +475,9 @@ int get_mcs_from_bler(module_id_t mod_id, int CC_id, frame_t frame, sub_frame_t
void nr_store_dlsch_buffer(module_id_t module_id,
frame_t frame,
sub_frame_t slot) {
-
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
-
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
sched_ctrl->num_total_bytes = 0;
sched_ctrl->dl_pdus_total = 0;
@@ -485,21 +485,20 @@ void nr_store_dlsch_buffer(module_id_t module_id,
/* loop over all activated logical channels */
// Note: DL_SCH_LCID_DCCH, DL_SCH_LCID_DCCH1, DL_SCH_LCID_DTCH
for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) {
-
const int lcid = sched_ctrl->dl_lc_ids[i];
const uint16_t rnti = UE_info->rnti[UE_id];
LOG_D(NR_MAC, "In %s: UE %d/%x: LCID %d\n", __FUNCTION__, UE_id, rnti, lcid);
start_meas(&RC.nrmac[module_id]->rlc_status_ind);
sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id,
- rnti,
- module_id,
- frame,
- slot,
- ENB_FLAG_YES,
- MBMS_FLAG_NO,
- lcid,
- 0,
- 0);
+ rnti,
+ module_id,
+ frame,
+ slot,
+ ENB_FLAG_YES,
+ MBMS_FLAG_NO,
+ lcid,
+ 0,
+ 0);
stop_meas(&RC.nrmac[module_id]->rlc_status_ind);
if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0)
@@ -531,6 +530,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
int UE_id,
int current_harq_pid) {
+
gNB_MAC_INST *nr_mac = RC.nrmac[module_id];
const NR_ServingCellConfigCommon_t *scc = nr_mac->common_channels->ServingCellConfigCommon;
NR_UE_info_t *UE_info = &nr_mac->UE_info;
@@ -558,30 +558,34 @@ bool allocate_dl_retransmission(module_id_t module_id,
const int coresetid = (sched_ctrl->active_bwp||bwpd) ? sched_ctrl->coreset->controlResourceSetId : RC.nrmac[module_id]->sched_ctrlCommon->coreset->controlResourceSetId;
const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
+
int rbStart = 0; // start wrt BWPstart
-
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
-
int rbSize = 0;
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot];
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
+
if (tda == retInfo->time_domain_allocation) {
/* Check that there are enough resources for retransmission */
while (rbSize < retInfo->rbSize) {
rbStart += rbSize; /* last iteration rbSize was not enough, skip it */
rbSize = 0;
+
while (rbStart < bwpSize &&
!(rballoc_mask[rbStart]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)))
rbStart++;
+
if (rbStart >= bwpSize) {
LOG_D(NR_MAC, "cannot allocate retransmission for UE %d/RNTI %04x: no resources\n", UE_id, UE_info->rnti[UE_id]);
return false;
}
+
while (rbStart + rbSize < bwpSize &&
(rballoc_mask[rbStart + rbSize]&SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols)) &&
rbSize < retInfo->rbSize)
rbSize++;
}
+
/* check whether we need to switch the TDA allocation since the last
* (re-)transmission */
if (ps->time_domain_allocation != tda || sched_ctrl->update_pdsch_ps) {
@@ -599,8 +603,8 @@ bool allocate_dl_retransmission(module_id_t module_id,
} else {
/* the retransmission will use a different time domain allocation, check
* that we have enough resources */
-
NR_pdsch_semi_static_t temp_ps = *ps;
+
nr_set_pdsch_semi_static(sib1,
scc,
UE_info->CellGroup[UE_id],
@@ -613,6 +617,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
while (rbStart < bwpSize &&
!(rballoc_mask[rbStart]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols)))
rbStart++;
+
while (rbStart + rbSize < bwpSize &&
(rballoc_mask[rbStart + rbSize]&SL_to_bitmap(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols)))
rbSize++;
@@ -629,10 +634,12 @@ bool allocate_dl_retransmission(module_id_t module_id,
rbSize,
&new_tbs,
&new_rbSize);
+
if (!success || new_tbs != retInfo->tb_size) {
- LOG_D(MAC, "%s(): new TBsize %d of new TDA does not match old TBS %d\n", __func__, new_tbs, retInfo->tb_size);
+ LOG_D(MAC, "new TBsize %d of new TDA does not match old TBS %d\n", new_tbs, retInfo->tb_size);
return false; /* the maximum TBsize we might have is smaller than what we need */
}
+
/* we can allocate it. Overwrite the time_domain_allocation, the number
* of RBs, and the new TB size. The rest is done below */
retInfo->tb_size = new_tbs;
@@ -645,12 +652,14 @@ bool allocate_dl_retransmission(module_id_t module_id,
const int cid = sched_ctrl->coreset->controlResourceSetId;
const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]);
uint8_t nr_of_candidates;
+
for (int i=0; i<5; i++) {
// for now taking the lowest value among the available aggregation levels
find_aggregation_candidates(&sched_ctrl->aggregation_level,
&nr_of_candidates,
sched_ctrl->search_space,
1<0) break;
}
@@ -670,12 +679,12 @@ bool allocate_dl_retransmission(module_id_t module_id,
/* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH
* allocation after CCE alloc fail would be more complex) */
+
int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, sched_ctrl->active_ubwp, ubwpd, CCEIndex);
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0);
if (alloc<0) {
LOG_D(MAC,
- "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
- __func__,
+ "could not find PUCCH for UE %d/%04x@%d.%d\n",
UE_id,
UE_info->rnti[UE_id],
frame,
@@ -685,23 +694,21 @@ bool allocate_dl_retransmission(module_id_t module_id,
}
sched_ctrl->cce_index = CCEIndex;
-
fill_pdcch_vrb_map(RC.nrmac[module_id],
/* CC_id = */ 0,
&sched_ctrl->sched_pdcch,
CCEIndex,
sched_ctrl->aggregation_level);
-
/* just reuse from previous scheduling opportunity, set new start RB */
sched_ctrl->sched_pdsch = *retInfo;
sched_ctrl->sched_pdsch.rbStart = rbStart;
-
sched_ctrl->sched_pdsch.pucch_allocation = alloc;
-
/* retransmissions: directly allocate */
*n_rb_sched -= sched_ctrl->sched_pdsch.rbSize;
+
for (int rb = 0; rb < sched_ctrl->sched_pdsch.rbSize; rb++)
rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] ^= SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
+
return true;
}
@@ -715,7 +722,6 @@ void pf_dl(module_id_t module_id,
int max_num_ue,
int n_rb_sched,
uint16_t *rballoc_mask) {
-
gNB_MAC_INST *mac = RC.nrmac[module_id];
NR_UE_info_t *UE_info = &mac->UE_info;
NR_ServingCellConfigCommon_t *scc=mac->common_channels[0].ServingCellConfigCommon;
@@ -728,15 +734,16 @@ void pf_dl(module_id_t module_id,
/* Loop UE_info->list to check retransmission */
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
if (UE_info->Msg4_ACKed[UE_id] != true) continue;
+
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
+
if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue;
+
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
/* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */
sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head;
-
layers[UE_id] = ps->nrOfLayers; // initialization of layers to the previous value in the strcuture
-
/* Calculate Throughput */
const float a = 0.0005f; // corresponds to 200ms window
const uint32_t b = UE_info->mac_stats[UE_id].dlsch_current_bytes;
@@ -746,13 +753,16 @@ void pf_dl(module_id_t module_id,
if (sched_pdsch->dl_harq_pid >= 0) {
/* Allocate retransmission */
bool r = allocate_dl_retransmission(
- module_id, frame, slot, rballoc_mask, &n_rb_sched, UE_id, sched_pdsch->dl_harq_pid);
+ module_id, frame, slot, rballoc_mask, &n_rb_sched, UE_id, sched_pdsch->dl_harq_pid);
+
if (!r) {
LOG_D(NR_MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot);
continue;
}
+
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
max_num_ue--;
+
if (max_num_ue < 0) return;
} else {
/* Check DL buffer and skip this UE if no bytes and no TA necessary */
@@ -782,18 +792,21 @@ void pf_dl(module_id_t module_id,
}
const int min_rbSize = 5;
+
/* Loop UE_sched to find max coeff and allocate transmission */
while (max_num_ue > 0 && n_rb_sched >= min_rbSize && UE_sched.head >= 0) {
-
/* Find max coeff from UE_sched*/
int *max = &UE_sched.head; /* assume head is max */
int *p = &UE_sched.next[*max];
+
while (*p >= 0) {
/* if the current one has larger coeff, save for later */
if (coeff_ue[*p] > coeff_ue[*max])
max = p;
+
p = &UE_sched.next[*p];
}
+
/* remove the max one: do not use remove_nr_list() it goes through the
* whole list every time. Note that UE_sched.tail might not be set
* correctly anymore */
@@ -803,6 +816,7 @@ void pf_dl(module_id_t module_id,
*p = -1;
NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id];
+
NR_BWP_DownlinkDedicated_t *bwpd =
cg &&
cg->spCellConfig &&
@@ -837,12 +851,14 @@ void pf_dl(module_id_t module_id,
const int cid = sched_ctrl->coreset->controlResourceSetId;
const uint16_t Y = get_Y(cid%3, slot, UE_info->rnti[UE_id]);
uint8_t nr_of_candidates;
+
for (int i=0; i<5; i++) {
// for now taking the lowest value among the available aggregation levels
find_aggregation_candidates(&sched_ctrl->aggregation_level,
&nr_of_candidates,
sched_ctrl->search_space,
1<0) break;
}
@@ -861,12 +877,13 @@ void pf_dl(module_id_t module_id,
/* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH
* allocation after CCE alloc fail would be more complex) */
+
int r_pucch = nr_get_pucch_resource(sched_ctrl->coreset, sched_ctrl->active_ubwp, ubwpd, CCEIndex);
const int alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot, r_pucch, 0);
+
if (alloc<0) {
LOG_D(NR_MAC,
- "%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
- __func__,
+ "could not find PUCCH for UE %d/%04x@%d.%d\n",
UE_id,
rnti,
frame,
@@ -879,21 +896,18 @@ void pf_dl(module_id_t module_id,
* and PUCCH */
max_num_ue--;
AssertFatal(max_num_ue >= 0, "Illegal max_num_ue %d\n", max_num_ue);
-
sched_ctrl->cce_index = CCEIndex;
-
fill_pdcch_vrb_map(mac,
/* CC_id = */ 0,
&sched_ctrl->sched_pdcch,
CCEIndex,
sched_ctrl->aggregation_level);
-
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
max_num_ue--;
+
if (max_num_ue < 0) return;
/* MCS has been set above */
-
const int tda = RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0][slot];
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
@@ -913,12 +927,14 @@ void pf_dl(module_id_t module_id,
}
const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols);
+
// Freq-demain allocation
while (rbStart < bwpSize &&
!(rballoc_mask[rbStart]&slbitmap))
rbStart++;
uint16_t max_rbSize = 1;
+
while (rbStart + max_rbSize < bwpSize &&
(rballoc_mask[rbStart + max_rbSize]&slbitmap))
max_rbSize++;
@@ -947,39 +963,41 @@ void pf_dl(module_id_t module_id,
sched_pdsch->rbSize = rbSize;
sched_pdsch->rbStart = rbStart;
sched_pdsch->tb_size = TBS;
-
/* transmissions: directly allocate */
n_rb_sched -= sched_pdsch->rbSize;
+
for (int rb = 0; rb < sched_pdsch->rbSize; rb++)
rballoc_mask[rb + sched_pdsch->rbStart] ^= slbitmap;
}
}
-void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot)
-{
+void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t slot) {
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
+
if (UE_info->num_UEs == 0)
return;
NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon;
const int CC_id = 0;
-
/* Get bwpSize and TDAfrom the first UE */
/* This is temporary and it assumes all UEs have the same BWP and TDA*/
int UE_id = UE_info->list.head;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
const int bwp_id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
+
if (!RC.nrmac[module_id]->preferred_dl_tda[bwp_id])
return;
+
const int tda = RC.nrmac[module_id]->preferred_dl_tda[bwp_id][slot];
int startSymbolIndex, nrOfSymbols;
const struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = sched_ctrl->active_bwp ?
- sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList :
- scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
+ sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList :
+ scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
AssertFatal(tda < tdaList->list.count, "time_domain_allocation %d>=%d\n", tda, tdaList->list.count);
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
+
const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(sched_ctrl->active_bwp,
RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon,
@@ -1000,19 +1018,20 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
uint16_t *vrb_map = RC.nrmac[module_id]->common_channels[CC_id].vrb_map;
uint16_t rballoc_mask[bwpSize];
int n_rb_sched = 0;
+
for (int i = 0; i < bwpSize; i++) {
// calculate mask: init with "NOT" vrb_map:
// if any RB in vrb_map is blocked (1), the current RBG will be 0
rballoc_mask[i] = (~vrb_map[i+BWPStart])&0x3fff; //bitwise not and 14 symbols
+
// if all the pdsch symbols are free
if((rballoc_mask[i]&slbitmap) ==
- slbitmap)
+ slbitmap)
n_rb_sched++;
}
/* Retrieve amount of data to send for this UE */
nr_store_dlsch_buffer(module_id, frame, slot);
-
/* proportional fair scheduling algorithm */
pf_dl(module_id,
frame,
@@ -1023,8 +1042,7 @@ void nr_fr1_dlsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
rballoc_mask);
}
-nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(module_id_t module_id, int CC_id)
-{
+nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(module_id_t module_id, int CC_id) {
/* in the PF algorithm, we have to use the TBsize to compute the coefficient.
* This would include the number of DMRS symbols, which in turn depends on
* the time domain allocation. In case we are in a mixed slot, we do not want
@@ -1034,16 +1052,17 @@ nr_pp_impl_dl nr_init_fr1_dlsch_preprocessor(module_id_t module_id, int CC_id)
for (int mcs = 0; mcs < 29; ++mcs) {
if (mcs > 27 && mcsTableIdx == 1)
continue;
+
const uint8_t Qm = nr_get_Qm_dl(mcs, mcsTableIdx);
const uint16_t R = nr_get_code_rate_dl(mcs, mcsTableIdx);
pf_tbs[mcsTableIdx][mcs] = nr_compute_tbs(Qm,
- R,
- 1, /* rbSize */
- 10, /* hypothetical number of slots */
- 0, /* N_PRB_DMRS * N_DMRS_SLOT */
- 0 /* N_PRB_oh, 0 for initialBWP */,
- 0 /* tb_scaling */,
- 1 /* nrOfLayers */)
+ R,
+ 1, /* rbSize */
+ 10, /* hypothetical number of slots */
+ 0, /* N_PRB_DMRS * N_DMRS_SLOT */
+ 0 /* N_PRB_oh, 0 for initialBWP */,
+ 0 /* tb_scaling */,
+ 1 /* nrOfLayers */)
>> 3;
}
}
@@ -1055,22 +1074,23 @@ void nr_schedule_ue_spec(module_id_t module_id,
frame_t frame,
sub_frame_t slot) {
gNB_MAC_INST *gNB_mac = RC.nrmac[module_id];
+
if (!is_xlsch_in_slot(gNB_mac->dlsch_slot_bitmap[slot / 64], slot))
return;
/* PREPROCESSOR */
gNB_mac->pre_processor_dl(module_id, frame, slot);
-
const int CC_id = 0;
NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon;
NR_UE_info_t *UE_info = &gNB_mac->UE_info;
-
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
-
NR_list_t *UE_list = &UE_info->list;
+
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
+
if (sched_ctrl->ul_failure==1 && get_softmodem_params()->phy_test==0) continue;
+
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
UE_info->mac_stats[UE_id].dlsch_current_bytes = 0;
NR_CellGroupConfig_t *cg = UE_info->CellGroup[UE_id];
@@ -1085,7 +1105,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
* Possible improvement: take the periodicity from input file.
* If such UE is not scheduled now, it will be by the preprocessor later.
* If we add the CE, ta_apply will be reset */
- if (frame == (sched_ctrl->ta_frame + 10) % 1024){
+ if (frame == (sched_ctrl->ta_frame + 10) % 1024) {
sched_ctrl->ta_apply = true; /* the timer is reset once TA CE is scheduled */
LOG_D(NR_MAC, "[UE %d][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE_id, frame, slot);
}
@@ -1094,19 +1114,17 @@ void nr_schedule_ue_spec(module_id_t module_id,
continue;
const rnti_t rnti = UE_info->rnti[UE_id];
-
/* pre-computed PDSCH values that only change if time domain
* allocation/DMRS parameters change. Updated in the preprocessor through
* nr_set_pdsch_semi_static() */
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
-
/* POST processing */
const uint8_t nrOfLayers = ps->nrOfLayers;
const uint16_t R = sched_pdsch->R;
const uint8_t Qm = sched_pdsch->Qm;
const uint32_t TBS = sched_pdsch->tb_size;
-
int8_t current_harq_pid = sched_pdsch->dl_harq_pid;
+
if (current_harq_pid < 0) {
/* PP has not selected a specific HARQ Process, get a new one */
current_harq_pid = sched_ctrl->available_dl_harq.head;
@@ -1124,6 +1142,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
else
remove_nr_list(&sched_ctrl->retrans_dl_harq, current_harq_pid);
}
+
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
DevAssert(!harq->is_waiting);
add_tail_nr_list(&sched_ctrl->feedback_dl_harq, current_harq_pid);
@@ -1132,8 +1151,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
harq->feedback_slot = pucch->ul_slot;
harq->is_waiting = true;
UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++;
-
- LOG_D(NR_MAC,"%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d nrOfLayers %d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) PUCCH allocation %d TPC %d\n",
+ LOG_D(NR_MAC,
+ "%4d.%2d [DLSCH/PDSCH/PUCCH] UE %d RNTI %04x DCI L %d start %3d RBs %3d startSymbol %2d nb_symbol %2d dmrspos %x MCS %2d nrOfLayers %d TBS %4d HARQ PID %2d round %d RV %d NDI %d dl_data_to_ULACK %d (%d.%d) PUCCH allocation %d TPC %d\n",
frame,
slot,
UE_id,
@@ -1156,8 +1175,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
pucch->ul_slot,
sched_pdsch->pucch_allocation,
sched_ctrl->tpc1);
-
NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp;
+
const NR_SIB1_t *sib1 = RC.nrmac[module_id]->common_channels[0].sib1 ? RC.nrmac[module_id]->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
NR_BWP_t *genericParameters = get_dl_bwp_genericParameters(bwp,
RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon,
@@ -1170,6 +1189,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
/* look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it */
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][coresetid];
+
if (!pdcch_pdu) {
LOG_D(NR_MAC, "creating pdcch pdu, pdcch_pdu = NULL. \n");
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
@@ -1190,7 +1210,6 @@ void nr_schedule_ue_spec(module_id_t module_id,
dl_tti_pdsch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdsch_pdu));
dl_req->nPDUs += 1;
nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15;
-
pdsch_pdu->pduBitmap = 0;
pdsch_pdu->rnti = rnti;
/* SCF222: PDU index incremented for each PDSCH PDU sent in TX control
@@ -1208,9 +1227,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
}
pdsch_pdu->SubcarrierSpacing = genericParameters->subcarrierSpacing;
-
pdsch_pdu->CyclicPrefix = genericParameters->cyclicPrefix ? *genericParameters->cyclicPrefix : 0;
-
// Codeword information
pdsch_pdu->NrOfCodewords = 1;
pdsch_pdu->targetCodeRate[0] = R;
@@ -1221,12 +1238,10 @@ void nr_schedule_ue_spec(module_id_t module_id,
AssertFatal(harq->round<4,"%d",harq->round);
pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round];
pdsch_pdu->TBSize[0] = TBS;
-
pdsch_pdu->dataScramblingId = *scc->physCellId;
pdsch_pdu->nrOfLayers = nrOfLayers;
pdsch_pdu->transmissionScheme = 0;
pdsch_pdu->refPoint = 0; // Point A
-
// DMRS
pdsch_pdu->dlDmrsSymbPos = ps->dl_dmrs_symb_pos;
pdsch_pdu->dmrsConfigType = ps->dmrsConfigType;
@@ -1234,18 +1249,16 @@ void nr_schedule_ue_spec(module_id_t module_id,
pdsch_pdu->SCID = 0;
pdsch_pdu->numDmrsCdmGrpsNoData = ps->numDmrsCdmGrpsNoData;
pdsch_pdu->dmrsPorts = (1<resourceAlloc = 1;
pdsch_pdu->rbStart = sched_pdsch->rbStart;
pdsch_pdu->rbSize = sched_pdsch->rbSize;
pdsch_pdu->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP
-
// Resource Allocation in time domain
pdsch_pdu->StartSymbolIndex = ps->startSymbolIndex;
pdsch_pdu->NrOfSymbols = ps->nrOfSymbols;
-
NR_PDSCH_Config_t *pdsch_Config=NULL;
+
if (bwp &&
bwp->bwp_Dedicated &&
bwp->bwp_Dedicated->pdsch_Config &&
@@ -1254,18 +1267,20 @@ void nr_schedule_ue_spec(module_id_t module_id,
/* Check and validate PTRS values */
struct NR_SetupRelease_PTRS_DownlinkConfig *phaseTrackingRS =
- pdsch_Config ? pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS : NULL;
+ pdsch_Config ? pdsch_Config->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS : NULL;
+
if (phaseTrackingRS) {
bool valid_ptrs_setup = set_dl_ptrs_values(phaseTrackingRS->choice.setup,
- pdsch_pdu->rbSize,
- pdsch_pdu->mcsIndex[0],
- pdsch_pdu->mcsTable[0],
- &pdsch_pdu->PTRSFreqDensity,
- &pdsch_pdu->PTRSTimeDensity,
- &pdsch_pdu->PTRSPortIndex,
- &pdsch_pdu->nEpreRatioOfPDSCHToPTRS,
- &pdsch_pdu->PTRSReOffset,
- pdsch_pdu->NrOfSymbols);
+ pdsch_pdu->rbSize,
+ pdsch_pdu->mcsIndex[0],
+ pdsch_pdu->mcsTable[0],
+ &pdsch_pdu->PTRSFreqDensity,
+ &pdsch_pdu->PTRSTimeDensity,
+ &pdsch_pdu->PTRSPortIndex,
+ &pdsch_pdu->nEpreRatioOfPDSCHToPTRS,
+ &pdsch_pdu->PTRSReOffset,
+ pdsch_pdu->NrOfSymbols);
+
if (valid_ptrs_setup)
pdsch_pdu->pduBitmap |= 0x1; // Bit 0: pdschPtrs - Indicates PTRS included (FR2)
}
@@ -1275,6 +1290,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci];
pdcch_pdu->numDlDci++;
dci_pdu->RNTI = rnti;
+
if (sched_ctrl->coreset &&
sched_ctrl->search_space &&
sched_ctrl->coreset->pdcch_DMRS_ScramblingID &&
@@ -1285,27 +1301,28 @@ void nr_schedule_ue_spec(module_id_t module_id,
dci_pdu->ScramblingId = *scc->physCellId;
dci_pdu->ScramblingRNTI = 0;
}
+
dci_pdu->AggregationLevel = sched_ctrl->aggregation_level;
dci_pdu->CceIndex = sched_ctrl->cce_index;
dci_pdu->beta_PDCCH_1_0 = 0;
dci_pdu->powerControlOffsetSS = 1;
-
/* DCI payload */
dci_pdu_rel15_t dci_payload;
memset(&dci_payload, 0, sizeof(dci_pdu_rel15_t));
// bwp indicator
const int n_dl_bwp = bwp ? UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count : 0;
AssertFatal(n_dl_bwp <= 1, "downlinkBWP_ToAddModList has %d BWP!\n", n_dl_bwp);
-
// as per table 7.3.1.1.2-1 in 38.212
dci_payload.bwp_indicator.val = bwp ? (n_dl_bwp < 4 ? bwp->bwp_Id : bwp->bwp_Id - 1) : 0;
+
if (bwp) AssertFatal(bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation == NR_PDSCH_Config__resourceAllocation_resourceAllocationType1,
- "Only frequency resource allocation type 1 is currently supported\n");
+ "Only frequency resource allocation type 1 is currently supported\n");
+
dci_payload.frequency_domain_assignment.val =
- PRBalloc_to_locationandbandwidth0(
- pdsch_pdu->rbSize,
- pdsch_pdu->rbStart,
- pdsch_pdu->BWPSize);
+ PRBalloc_to_locationandbandwidth0(
+ pdsch_pdu->rbSize,
+ pdsch_pdu->rbStart,
+ pdsch_pdu->BWPSize);
dci_payload.format_indicator = 1;
dci_payload.time_domain_assignment.val = ps->time_domain_allocation;
dci_payload.mcs = sched_pdsch->mcs;
@@ -1336,11 +1353,11 @@ void nr_schedule_ue_spec(module_id_t module_id,
dci_payload.tpc,
pucch->timing_indicator);
+
int dci_format = ss && ss->searchSpaceType && ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific ?
NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0;
const int rnti_type = NR_RNTI_C;
-
fill_dci_pdu_rel15(scc,
UE_info->CellGroup[UE_id],
dci_pdu,
@@ -1359,7 +1376,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
if (harq->round != 0) { /* retransmission */
/* we do not have to do anything, since we do not require to get data
- * from RLC or encode MAC CEs. The TX_req structure is filled below
+ * from RLC or encode MAC CEs. The TX_req structure is filled below
* or copy data to FAPI structures */
LOG_D(NR_MAC,
"%d.%2d DL retransmission UE %d/RNTI %04x HARQ PID %d round %d NDI %d\n",
@@ -1370,20 +1387,15 @@ void nr_schedule_ue_spec(module_id_t module_id,
current_harq_pid,
harq->round,
harq->ndi);
-
AssertFatal(harq->sched_pdsch.tb_size == TBS,
"UE %d mismatch between scheduled TBS and buffered TB for HARQ PID %d\n",
UE_id,
current_harq_pid);
-
T(T_GNB_MAC_RETRANSMISSION_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti),
- T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->tb, TBS));
+ T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->transportBlock, TBS));
} else { /* initial transmission */
-
LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot);
-
- uint8_t *buf = (uint8_t *) harq->tb;
-
+ uint8_t *buf = (uint8_t *) harq->transportBlock;
/* first, write all CEs that might be there */
int written = nr_write_ce_dlsch_pdu(module_id,
sched_ctrl,
@@ -1391,32 +1403,30 @@ void nr_schedule_ue_spec(module_id_t module_id,
255, // no drx
NULL); // contention res id
buf += written;
- int size = TBS - written;
- DevAssert(size >= 0);
+ uint8_t *bufEnd = buf + TBS - written;
+ DevAssert(TBS > written);
+ int dlsch_total_bytes = 0;
/* next, get RLC data */
-
start_meas(&gNB_mac->rlc_data_req);
- if (sched_ctrl->num_total_bytes > 0) {
+ if (sched_ctrl->num_total_bytes > 0) {
/* loop over all activated logical channels */
for (int i = 0; i < sched_ctrl->dl_lc_num; ++i) {
-
const int lcid = sched_ctrl->dl_lc_ids[i];
- if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0)
- continue; // no data for this LC
- int dlsch_total_bytes = 0;
- while (size > 3) {
+ if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0)
+ continue; // no data for this LC tbs_size_t len = 0;
+
+ int lcid_bytes=0;
+ while (bufEnd-buf > sizeof(NR_MAC_SUBHEADER_LONG) + 1 ) {
// we do not know how much data we will get from RLC, i.e., whether it
// will be longer than 256B or not. Therefore, reserve space for long header, then
// fetch data, then fill real length
NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf;
- buf += 3;
- size -= 3;
-
/* limit requested number of bytes to what preprocessor specified, or
* such that TBS is full */
- const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, size);
+ const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer,
+ bufEnd-buf-sizeof(NR_MAC_SUBHEADER_LONG));
tbs_size_t len = mac_rlc_data_req(module_id,
rnti,
module_id,
@@ -1425,12 +1435,11 @@ void nr_schedule_ue_spec(module_id_t module_id,
MBMS_FLAG_NO,
lcid,
ndata,
- (char *)buf,
+ (char *)buf+sizeof(NR_MAC_SUBHEADER_LONG),
0,
0);
-
LOG_D(NR_MAC,
- "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %d)\n",
+ "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %ld)\n",
frame,
slot,
rnti,
@@ -1438,64 +1447,56 @@ void nr_schedule_ue_spec(module_id_t module_id,
lcid < 4 ? "DCCH" : "DTCH",
lcid,
ndata,
- size);
- if (len == 0) {
- /* RLC did not have data anymore, mark buffer as unused */
- buf -= 3;
- size += 3;
+ bufEnd-buf-+sizeof(NR_MAC_SUBHEADER_LONG));
+
+ if (len == 0)
break;
- }
header->R = 0;
header->F = 1;
header->LCID = lcid;
- header->L1 = (len >> 8) & 0xff;
- header->L2 = len & 0xff;
- size -= len;
- buf += len;
+ header->L = htons(len);
+ buf += len+sizeof(NR_MAC_SUBHEADER_LONG);
dlsch_total_bytes += len;
+ lcid_bytes += len;
}
- UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes;
+ UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += lcid_bytes;
}
} else if (get_softmodem_params()->phy_test || get_softmodem_params()->do_ra) {
/* we will need the large header, phy-test typically allocates all
* resources and fills to the last byte below */
- NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf;
- buf += 3;
- size -= 3;
- DevAssert(size > 0);
- LOG_D(NR_MAC, "Configuring DL_TX in %d.%d: TBS %d with %d B of random data\n", frame, slot, TBS, size);
- // fill dlsch_buffer with random data
- for (int i = 0; i < size; i++)
- buf[i] = lrand48() & 0xff;
- header->R = 0;
- header->F = 1;
- header->LCID = DL_SCH_LCID_PADDING;
- header->L1 = (size >> 8) & 0xff;
- header->L2 = size & 0xff;
- size -= size;
- buf += size;
+ LOG_D(NR_MAC, "Configuring DL_TX in %d.%d: TBS %d of random data\n", frame, slot, TBS);
+
+ if (bufEnd-buf > sizeof(NR_MAC_SUBHEADER_LONG) ) {
+ NR_MAC_SUBHEADER_LONG *header = (NR_MAC_SUBHEADER_LONG *) buf;
+ // fill dlsch_buffer with random data
+ header->R = 0;
+ header->F = 1;
+ header->LCID = DL_SCH_LCID_PADDING;
+ buf += sizeof(NR_MAC_SUBHEADER_LONG);
+ header->L = htons(bufEnd-buf);
+ dlsch_total_bytes += bufEnd-buf;
+
+ for (; buf < bufEnd; buf++)
+ *buf = lrand48() & 0xff;
+ }
}
+
stop_meas(&gNB_mac->rlc_data_req);
// Add padding header and zero rest out if there is space left
- if (size > 0) {
+ if (bufEnd-buf > 0) {
NR_MAC_SUBHEADER_FIXED *padding = (NR_MAC_SUBHEADER_FIXED *) buf;
padding->R = 0;
padding->LCID = DL_SCH_LCID_PADDING;
- size -= 1;
buf += 1;
- while (size > 0) {
- *buf = 0;
- buf += 1;
- size -= 1;
- }
+ memset(buf,0,bufEnd-buf);
+ buf=bufEnd;
}
UE_info->mac_stats[UE_id].dlsch_total_bytes += TBS;
UE_info->mac_stats[UE_id].dlsch_current_bytes = TBS;
-
/* save retransmission information */
harq->sched_pdsch = *sched_pdsch;
/* save which time allocation has been used, to be used on
@@ -1514,7 +1515,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
}
T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti),
- T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_BUFFER(harq->tb, TBS));
+ T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_BUFFER(harq->transportBlock, TBS));
}
const int ntx_req = gNB_mac->TX_req[CC_id].Number_of_PDUs;
@@ -1523,11 +1524,10 @@ void nr_schedule_ue_spec(module_id_t module_id,
tx_req->PDU_index = pduindex;
tx_req->num_TLV = 1;
tx_req->TLVs[0].length = TBS + 2;
- memcpy(tx_req->TLVs[0].value.direct, harq->tb, TBS);
+ memcpy(tx_req->TLVs[0].value.direct, harq->transportBlock, TBS);
gNB_mac->TX_req[CC_id].Number_of_PDUs++;
gNB_mac->TX_req[CC_id].SFN = frame;
gNB_mac->TX_req[CC_id].Slot = slot;
-
/* mark UE as scheduled */
sched_pdsch->rbSize = 0;
}
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
index e21d1e50f7..43822d0cd0 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c
@@ -51,7 +51,7 @@ void nr_fill_nfapi_pucch(module_id_t mod_id,
&RC.nrmac[mod_id]->UL_tti_req_ahead[0][pucch->ul_slot];
AssertFatal(future_ul_tti_req->SFN == pucch->frame
&& future_ul_tti_req->Slot == pucch->ul_slot,
- "future UL_tti_req's frame.slot %d.%d does not match PUCCH %d.%d\n",
+ "future UL_tti_req's frame.slot %4d.%2d does not match PUCCH %4d.%2d\n",
future_ul_tti_req->SFN,
future_ul_tti_req->Slot,
pucch->frame,
@@ -84,7 +84,7 @@ void nr_fill_nfapi_pucch(module_id_t mod_id,
cg->spCellConfig->spCellConfigDedicated->uplinkConfig ?
cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP : NULL;
- LOG_D(NR_MAC,"%d.%d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch to be scheduled in %d.%d\n",
+ LOG_D(NR_MAC,"%4d.%2d Calling nr_configure_pucch (ubwpd %p,r_pucch %d) pucch to be scheduled in %4d.%2d\n",
frame,slot,ubwpd,pucch->r_pucch,pucch->frame,pucch->ul_slot);
const NR_SIB1_t *sib1 = nr_mac->common_channels[0].sib1 ? nr_mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1 : NULL;
@@ -161,7 +161,7 @@ void nr_schedule_pucch(int Mod_idP,
|| frameP != curr_pucch->frame
|| slotP != curr_pucch->ul_slot)
continue;
- LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %d.%d O_ack %d\n",i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack);
+ LOG_D(NR_MAC,"Scheduling PUCCH[%d] RX for UE %d in %4d.%2d O_ack %d\n",i,UE_id,curr_pucch->frame,curr_pucch->ul_slot,O_ack);
nr_fill_nfapi_pucch(Mod_idP, frameP, slotP, curr_pucch, UE_id);
memset(curr_pucch, 0, sizeof(*curr_pucch));
}
@@ -820,6 +820,7 @@ static void handle_dl_harq(module_id_t mod_id,
stats->dlsch_errors++;
LOG_D(NR_MAC, "retransmission error for UE %d (total %"PRIu64")\n", UE_id, stats->dlsch_errors);
} else {
+ LOG_D(PHY,"NACK for: pid %d, ue %x\n",harq_pid, UE_id);
add_tail_nr_list(&UE_info->UE_sched_ctrl[UE_id].retrans_dl_harq, harq_pid);
harq->round++;
}
@@ -1398,7 +1399,7 @@ static NR_UE_harq_t *find_harq(module_id_t mod_id, frame_t frame, sub_frame_t sl
while (harq->feedback_frame != frame
|| (harq->feedback_frame == frame && harq->feedback_slot < slot)) {
LOG_W(NR_MAC,
- "expected HARQ pid %d feedback at %d.%d, but is at %d.%d instead (HARQ feedback is in the past)\n",
+ "expected HARQ pid %d feedback at %4d.%2d, but is at %4d.%2d instead (HARQ feedback is in the past)\n",
pid,
harq->feedback_frame,
harq->feedback_slot,
@@ -1414,7 +1415,7 @@ static NR_UE_harq_t *find_harq(module_id_t mod_id, frame_t frame, sub_frame_t sl
/* feedbacks that we wait for in the future: don't do anything */
if (harq->feedback_slot > slot) {
LOG_W(NR_MAC,
- "expected HARQ pid %d feedback at %d.%d, but is at %d.%d instead (HARQ feedback is in the future)\n",
+ "expected HARQ pid %d feedback at %4d.%2d, but is at %4d.%2d instead (HARQ feedback is in the future)\n",
pid,
harq->feedback_frame,
harq->feedback_slot,
@@ -1451,7 +1452,7 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id,
DevAssert(harq->is_waiting);
const int8_t pid = sched_ctrl->feedback_dl_harq.head;
remove_front_nr_list(&sched_ctrl->feedback_dl_harq);
- LOG_D(NR_MAC,"bit %d pid %d ack/nack %d\n",harq_bit,pid,harq_value);
+ LOG_D(NR_MAC,"%4d.%2d bit %d pid %d ack/nack %d\n",frame, slot, harq_bit,pid,harq_value);
handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0);
if (harq_confidence == 1) UE_info->mac_stats[UE_id].pucch0_DTX++;
}
@@ -1493,10 +1494,11 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
// tpc (power control)
- sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10,
- uci_234->ul_cqi,
- 30);
- sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640;
+ // TODO PUCCH2 SNR computation is not correct -> ignore the following
+ //sched_ctrl->tpc1 = nr_get_tpc(RC.nrmac[mod_id]->pucch_target_snrx10,
+ // uci_234->ul_cqi,
+ // 30);
+ //sched_ctrl->pucch_snrx10 = uci_234->ul_cqi * 5 - 640;
if ((uci_234->pduBitmap >> 1) & 0x01) {
// iterate over received harq bits
@@ -1635,7 +1637,7 @@ int nr_acknack_scheduling(int mod_id,
int bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0];
- LOG_D(NR_MAC, "In %s: %d.%d Trying to allocate pucch, current DAI %d\n", __FUNCTION__, frame, slot, pucch->dai_c);
+ LOG_D(NR_MAC, "In %s: %4d.%2d Trying to allocate pucch, current DAI %d\n", __FUNCTION__, frame, slot, pucch->dai_c);
pucch->r_pucch=r_pucch;
AssertFatal(pucch->csi_bits == 0,
@@ -1649,7 +1651,7 @@ int nr_acknack_scheduling(int mod_id,
* the same slot again */
const int f = pucch->frame;
const int s = pucch->ul_slot;
- LOG_D(NR_MAC, "In %s: %d.%d DAI = 2 pucch currently in %d.%d, advancing by 1 slot\n", __FUNCTION__, frame, slot, f, s);
+ LOG_D(NR_MAC, "In %s: %4d.%2d DAI = 2 pucch currently in %4d.%2d, advancing by 1 slot\n", __FUNCTION__, frame, slot, f, s);
nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id);
memset(pucch, 0, sizeof(*pucch));
pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f;
@@ -1676,7 +1678,7 @@ int nr_acknack_scheduling(int mod_id,
}
}
- LOG_D(NR_MAC, "In %s: pucch_acknak 1. DL %d.%d, UL_ACK %d.%d, DAI_C %d\n", __FUNCTION__, frame, slot, pucch->frame, pucch->ul_slot, pucch->dai_c);
+ LOG_D(NR_MAC, "In %s: pucch_acknak 1. DL %4d.%2d, UL_ACK %4d.%2d, DAI_C %d\n", __FUNCTION__, frame, slot, pucch->frame, pucch->ul_slot, pucch->dai_c);
// this is hardcoded for now as ue specific only if we are not on the initialBWP (to be fixed to allow ue_Specific also on initialBWP
NR_BWP_UplinkDedicated_t *ubwpd=NULL;
@@ -1696,7 +1698,7 @@ int nr_acknack_scheduling(int mod_id,
int max_fb_time = 0;
get_pdsch_to_harq_feedback(mod_id, UE_id, bwp_Id, ss_type, &max_fb_time, pdsch_to_harq_feedback);
- LOG_D(NR_MAC, "In %s: 1b. DL %d.%d, UL_ACK %d.%d, DAI_C %d\n", __FUNCTION__, frame,slot,pucch->frame,pucch->ul_slot,pucch->dai_c);
+ LOG_D(NR_MAC, "In %s: 1b. DL %4d.%2d, UL_ACK %4d.%2d, DAI_C %d\n", __FUNCTION__, frame,slot,pucch->frame,pucch->ul_slot,pucch->dai_c);
/* there is a HARQ. Check whether we can use it for this ACKNACK */
if (pucch->dai_c > 0) {
/* this UE already has a PUCCH occasion */
@@ -1716,7 +1718,7 @@ int nr_acknack_scheduling(int mod_id,
const int f = pucch->frame;
const int s = pucch->ul_slot;
const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
- LOG_D(NR_MAC, "In %s: %d.%d DAI > 0, cannot reach timing for pucch in %d.%d, advancing slot by 1 and trying again\n", __FUNCTION__, frame, slot, f, s);
+ LOG_D(NR_MAC, "In %s: %4d.%2d DAI > 0, cannot reach timing for pucch in %4d.%2d, advancing slot by 1 and trying again\n", __FUNCTION__, frame, slot, f, s);
nr_fill_nfapi_pucch(mod_id, frame, slot, pucch, UE_id);
memset(pucch, 0, sizeof(*pucch));
pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f;
@@ -1730,11 +1732,11 @@ int nr_acknack_scheduling(int mod_id,
pucch->timing_indicator = i;
pucch->dai_c++;
// retain old resource indicator, and we are good
- LOG_D(NR_MAC, "In %s: %d.%d. DAI > 0, pucch allocated for %d.%d (index %d)\n", __FUNCTION__, frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator);
+ LOG_D(NR_MAC, "In %s: %4d.%2d. DAI > 0, pucch allocated for %4d.%2d (index %d)\n", __FUNCTION__, frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator);
return 0;
}
- LOG_D(NR_MAC, "In %s: %d.%d DAI = 0, looking for new pucch occasion\n", __FUNCTION__, frame, slot);
+ LOG_D(NR_MAC, "In %s: %4d.%2d DAI = 0, looking for new pucch occasion\n", __FUNCTION__, frame, slot);
/* we need to find a new PUCCH occasion */
/*(Re)Inizialization of timing information*/
@@ -1837,7 +1839,7 @@ int nr_acknack_scheduling(int mod_id,
pucch->timing_indicator = ind_found; // index in the list of timing indicators
- LOG_D(NR_MAC, "In %s: 2. DAI 0 DL %d.%d, UL_ACK %d.%d (index %d)\n", __FUNCTION__, frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator);
+ LOG_D(NR_MAC, "In %s: 2. DAI 0 DL %4d.%2d, UL_ACK %4d.%2d (index %d)\n", __FUNCTION__, frame,slot,pucch->frame,pucch->ul_slot,pucch->timing_indicator);
pucch->dai_c++;
pucch->resource_indicator = 0; // each UE has dedicated PUCCH resources
diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
index 9273c38de3..72061bb9ba 100644
--- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
+++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
@@ -55,7 +55,7 @@ void calculate_preferred_ul_tda(module_id_t module_id, const NR_BWP_Uplink_t *ub
/* there is a mixed slot only when in TDD */
NR_ServingCellConfigCommon_t *scc = nrmac->common_channels->ServingCellConfigCommon;
- lte_frame_type_t frame_type = nrmac->common_channels->frame_type;
+ frame_type_t frame_type = nrmac->common_channels->frame_type;
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
NR_ServingCellConfigCommonSIB_t *scc_sib1 = get_softmodem_params()->sa ?
@@ -213,11 +213,8 @@ int nr_process_mac_pdu(module_id_t module_idP,
int pdu_len)
{
- uint8_t rx_lcid;
+
uint8_t done = 0;
- uint16_t mac_ce_len;
- uint16_t mac_subheader_len;
- uint16_t mac_sdu_len;
NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
@@ -231,10 +228,9 @@ int nr_process_mac_pdu(module_id_t module_idP,
#endif
while (!done && pdu_len > 0){
- mac_ce_len = 0;
- mac_subheader_len = sizeof(NR_MAC_SUBHEADER_FIXED);
- mac_sdu_len = 0;
- rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
+ uint16_t mac_len=0;
+ uint16_t mac_subheader_len=sizeof(NR_MAC_SUBHEADER_FIXED);
+ uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID;
LOG_D(NR_MAC, "In %s: received UL-SCH sub-PDU with LCID 0x%x in %d.%d (remaining PDU length %d)\n", __func__, rx_lcid, frameP, slot, pdu_len);
@@ -249,7 +245,7 @@ int nr_process_mac_pdu(module_id_t module_idP,
#endif*/
case UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY:
// 38.321 Ch6.1.3.20
- mac_ce_len = 2;
+ mac_len = 2;
break;
case UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION:
// 38.321 Ch6.1.3.7
@@ -259,7 +255,7 @@ int nr_process_mac_pdu(module_id_t module_idP,
case UL_SCH_LCID_S_TRUNCATED_BSR:
//38.321 section 6.1.3.1
//fixed length
- mac_ce_len =1;
+ mac_len =1;
/* Extract short BSR value */
ce_ptr = &pduP[mac_subheader_len];
NR_BSR_SHORT *bsr_s = (NR_BSR_SHORT *) ce_ptr;
@@ -284,16 +280,8 @@ int nr_process_mac_pdu(module_id_t module_idP,
to be a partial PDU at the end of this buffer, so here
we gracefully ignore that by returning 0. See:
https://gitlab.eurecom.fr/oai/openairinterface5g/-/issues/534 */
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
- return 0;
- mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
- return 0;
- mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- mac_subheader_len = 3;
- }
+ if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
+ return 0;
/* Extract long BSR value */
ce_ptr = &pduP[mac_subheader_len];
NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr;
@@ -339,14 +327,14 @@ int nr_process_mac_pdu(module_id_t module_idP,
//38.321 section 6.1.3.2
//fixed length
- mac_ce_len = 2;
+ mac_len = 2;
/* Extract CRNTI value */
break;
case UL_SCH_LCID_SINGLE_ENTRY_PHR:
//38.321 section 6.1.3.8
//fixed length
- mac_ce_len = 2;
+ mac_len = 2;
/* Extract SINGLE ENTRY PHR elements for PHR calculation */
ce_ptr = &pduP[mac_subheader_len];
NR_SINGLE_ENTRY_PHR_MAC_CE *phr = (NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr;
@@ -367,32 +355,16 @@ int nr_process_mac_pdu(module_id_t module_idP,
case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT:
//38.321 section 6.1.3.9
// varialbe length
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
- return 0;
- mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
- return 0;
- mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- mac_subheader_len = 3;
- }
+ if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
+ return 0;
/* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */
break;
case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT:
//38.321 section 6.1.3.9
// varialbe length
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
- return 0;
- mac_ce_len |= (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
- return 0;
- mac_ce_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- mac_subheader_len = 3;
- }
+ if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
+ return 0;
/* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */
break;
@@ -403,27 +375,16 @@ int nr_process_mac_pdu(module_id_t module_idP,
case UL_SCH_LCID_SRB1:
case UL_SCH_LCID_SRB2:
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
- return 0;
- if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){
- //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
- return 0;
- mac_subheader_len = 3;
- mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8)
- | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff);
- } else {
- mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- }
+ if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
+ return 0;
rnti_t crnti = UE_info->rnti[UE_id];
int UE_idx = UE_id;
for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) {
NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i];
if (ra->state >= WAIT_Msg3 && ra->rnti == UE_info->rnti[UE_id]) {
- uint8_t *next_subpduP = pduP + mac_subheader_len + mac_sdu_len;
- if ((pduP[mac_subheader_len+mac_sdu_len] & 0x3F) == UL_SCH_LCID_C_RNTI) {
+ uint8_t *next_subpduP = pduP + mac_subheader_len + mac_len;
+ if ((pduP[mac_subheader_len+mac_len] & 0x3F) == UL_SCH_LCID_C_RNTI) {
crnti = ((next_subpduP[1]&0xFF)<<8)|(next_subpduP[2]&0xFF);
UE_idx = find_nr_UE_id(module_idP, crnti);
break;
@@ -432,7 +393,7 @@ int nr_process_mac_pdu(module_id_t module_idP,
}
if (UE_info->CellGroup[UE_idx]) {
- LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: 0x%04x \n", module_idP, frameP, rx_lcid, module_idP, mac_sdu_len, crnti);
+ LOG_D(NR_MAC, "[UE %d] Frame %d : ULSCH -> UL-DCCH %d (gNB %d, %d bytes), rnti: 0x%04x \n", module_idP, frameP, rx_lcid, module_idP, mac_len, crnti);
mac_rlc_data_ind(module_idP,
crnti,
module_idP,
@@ -441,7 +402,7 @@ int nr_process_mac_pdu(module_id_t module_idP,
MBMS_FLAG_NO,
rx_lcid,
(char *) (pduP + mac_subheader_len),
- mac_sdu_len,
+ mac_len,
1,
NULL);
} else {
@@ -459,23 +420,23 @@ int nr_process_mac_pdu(module_id_t module_idP,
if ( rx_lcid == UL_SCH_LCID_CCCH1 ) {
// RRCResumeRequest1 message includes the full I-RNTI and has a size of 8 bytes
- mac_sdu_len = 8;
+ mac_len = 8;
// Check if it is a valid CCCH1 message, we get all 00's messages very often
int i = 0;
- for(i=0; i<(mac_subheader_len+mac_sdu_len); i++) {
+ for(i=0; i<(mac_subheader_len+mac_len); i++) {
if(pduP[i] != 0) {
break;
}
}
- if (i == (mac_subheader_len+mac_sdu_len)) {
+ if (i == (mac_subheader_len+mac_len)) {
LOG_D(NR_MAC, "%s() Invalid CCCH1 message!, pdu_len: %d\n", __func__, pdu_len);
done = 1;
break;
}
} else {
// fixed length of 6 bytes
- mac_sdu_len = 6;
+ mac_len = 6;
}
nr_mac_rrc_data_ind(module_idP,
@@ -486,26 +447,14 @@ int nr_process_mac_pdu(module_id_t module_idP,
UE_info->rnti[UE_id],
CCCH,
pduP + mac_subheader_len,
- mac_sdu_len,
+ mac_len,
0);
break;
case UL_SCH_LCID_DTCH:
// check if LCID is valid at current time.
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT))
- return 0;
- if (((NR_MAC_SUBHEADER_SHORT *)pduP)->F) {
- // mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8;
- if (pdu_len < sizeof(NR_MAC_SUBHEADER_LONG))
- return 0;
- mac_subheader_len = 3;
- mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L1 & 0x7f) << 8)
- | ((uint16_t)((NR_MAC_SUBHEADER_LONG *)pduP)->L2 & 0xff);
-
- } else {
- mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L;
- mac_subheader_len = 2;
- }
+ if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len))
+ return 0;
LOG_D(NR_MAC, "In %s: [UE %d] %d.%d : ULSCH -> UL-%s %d (gNB %d, %d bytes)\n",
__func__,
@@ -515,8 +464,8 @@ int nr_process_mac_pdu(module_id_t module_idP,
rx_lcid<4?"DCCH":"DTCH",
rx_lcid,
module_idP,
- mac_sdu_len);
- UE_info->mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_sdu_len;
+ mac_len);
+ UE_info->mac_stats[UE_id].lc_bytes_rx[rx_lcid] += mac_len;
mac_rlc_data_ind(module_idP,
UE_info->rnti[UE_id],
@@ -526,13 +475,13 @@ int nr_process_mac_pdu(module_id_t module_idP,
MBMS_FLAG_NO,
rx_lcid,
(char *)(pduP + mac_subheader_len),
- mac_sdu_len,
+ mac_len,
1,
NULL);
/* Updated estimated buffer when receiving data */
- if (sched_ctrl->estimated_ul_buffer >= mac_sdu_len)
- sched_ctrl->estimated_ul_buffer -= mac_sdu_len;
+ if (sched_ctrl->estimated_ul_buffer >= mac_len)
+ sched_ctrl->estimated_ul_buffer -= mac_len;
else
sched_ctrl->estimated_ul_buffer = 0;
break;
@@ -547,16 +496,16 @@ int nr_process_mac_pdu(module_id_t module_idP,
if (rx_lcid < 45 || rx_lcid == 52 || rx_lcid == 63) {
LOG_I(NR_MAC, "In %s: dumping UL MAC SDU sub-header with length %d (LCID = 0x%02x):\n", __func__, mac_subheader_len, rx_lcid);
log_dump(NR_MAC, pduP, mac_subheader_len, LOG_DUMP_CHAR, "\n");
- LOG_I(NR_MAC, "In %s: dumping UL MAC SDU with length %d (LCID = 0x%02x):\n", __func__, mac_sdu_len, rx_lcid);
- log_dump(NR_MAC, pduP + mac_subheader_len, mac_sdu_len, LOG_DUMP_CHAR, "\n");
+ LOG_I(NR_MAC, "In %s: dumping UL MAC SDU with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid);
+ log_dump(NR_MAC, pduP + mac_subheader_len, mac_len, LOG_DUMP_CHAR, "\n");
} else {
- LOG_I(NR_MAC, "In %s: dumping UL MAC CE with length %d (LCID = 0x%02x):\n", __func__, mac_ce_len, rx_lcid);
- log_dump(NR_MAC, pduP + mac_subheader_len + mac_sdu_len, mac_ce_len, LOG_DUMP_CHAR, "\n");
+ LOG_I(NR_MAC, "In %s: dumping UL MAC CE with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid);
+ log_dump(NR_MAC, pduP + mac_subheader_len + mac_len, mac_len, LOG_DUMP_CHAR, "\n");
}
#endif
- pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len );
- pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len );
+ pduP += ( mac_subheader_len + mac_len );
+ pdu_len -= ( mac_subheader_len + mac_len );
if (pdu_len < 0) {
LOG_E(NR_MAC, "In %s: residual UL MAC PDU in %d.%d with length < 0!, pdu_len %d \n", __func__, frameP, slot, pdu_len);
diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
index 0f538131dd..e32e63a778 100644
--- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
+++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h
@@ -202,7 +202,7 @@ typedef struct {
int p_gNB;
int Ncp;
int nr_band;
- lte_frame_type_t frame_type;
+ frame_type_t frame_type;
uint64_t dl_CarrierFreq;
NR_BCCH_BCH_Message_t *mib;
NR_BCCH_DL_SCH_Message_t *sib1;
@@ -445,7 +445,7 @@ typedef struct NR_UE_harq {
/* Transport block to be sent using this HARQ process, its size is in
* sched_pdsch */
- uint32_t tb[16384];
+ uint32_t transportBlock[16384];
uint32_t tb_size;
/// sched_pdsch keeps information on MCS etc used for the initial transmission
diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c
index af8cb5715a..2382db267f 100644
--- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c
+++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c
@@ -103,36 +103,6 @@ static int segment_already_received(nr_rlc_entity_am_t *entity,
return size <= 0;
}
-static void consider_retransmission(nr_rlc_entity_am_t *entity,
- nr_rlc_sdu_segment_t *cur, int update_retx)
-{
- if (update_retx)
- cur->sdu->retx_count++;
-
- /* let's report max RETX reached for all retx_count >= max_retx_threshold
- * (specs say to report if retx_count == max_retx_threshold).
- * Upper layers should react (radio link failure), so no big deal actually.
- */
- if (update_retx && cur->sdu->retx_count >= entity->max_retx_threshold) {
- entity->common.max_retx_reached(entity->common.max_retx_reached_data,
- (nr_rlc_entity_t *)entity);
- }
-
- /* let's put in retransmit list even if we are over max_retx_threshold.
- * upper layers should deal with this condition, internally it's better
- * for the RLC code to keep going with this segment (we only remove
- * a segment that was ACKed)
- */
- LOG_D(RLC, "RLC segment to be added at the ReTx list \n");
- nr_rlc_sdu_segment_list_append(&entity->retransmit_list,
- &entity->retransmit_end,
- cur);
-
- /* update buffer status */
- entity->common.bstatus.retx_size += compute_pdu_header_size(entity, cur)
- + cur->size;
-}
-
/* checks that all the bytes of the SDU sn have been received (but SDU
* has not been already processed)
*/
@@ -315,81 +285,6 @@ static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu)
}
}
-static void process_received_ack(nr_rlc_entity_am_t *entity, int ack_sn)
-{
- nr_rlc_sdu_segment_t head;
- nr_rlc_sdu_segment_t *cur;
- nr_rlc_sdu_segment_t *prev;
- unsigned char sn_set[32768]; /* used to dec retx_count only once per sdu */
-
- memset(sn_set, 0, 32768);
-
-#define IS_SN_SET(b) (sn_set[(b)/8] & (1 << ((b) % 8)))
-#define SET_SN(b) do { sn_set[(b)/8] |= (1 << ((b) % 8)); } while (0)
-
- /* put SDUs from wait and retransmit lists with SN < 'ack_sn' to ack_list */
-
- /* process wait list */
- head.next = entity->wait_list;
- prev = &head;
- cur = entity->wait_list;
- while (cur != NULL) {
- if (sn_compare_tx(entity, cur->sdu->sn, ack_sn) < 0) {
- /* remove from wait list */
- prev->next = cur->next;
- /* put the PDU in the ack list */
- entity->ack_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity,
- entity->ack_list, cur);
- entity->wait_end = prev;
- cur = prev->next;
- } else {
- entity->wait_end = cur;
- prev = cur;
- cur = cur->next;
- }
- }
- entity->wait_list = head.next;
- if (entity->wait_list == NULL)
- entity->wait_end = NULL;
-
- /* process retransmit list */
- head.next = entity->retransmit_list;
- prev = &head;
- cur = entity->retransmit_list;
- while (cur != NULL) {
- if (sn_compare_tx(entity, cur->sdu->sn, ack_sn) < 0) {
- /* dec. retx_count in case we put this segment back in retransmit list
- * in 'process_received_nack'
- * do it only once per SDU
- */
- if (!IS_SN_SET(cur->sdu->sn)) {
- cur->sdu->retx_count--;
- SET_SN(cur->sdu->sn);
- }
- /* remove from retransmit list */
- prev->next = cur->next;
- /* update buffer status */
- entity->common.bstatus.retx_size -= compute_pdu_header_size(entity, cur)
- + cur->size;
- /* put the PDU in the ack list */
- entity->ack_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity,
- entity->ack_list, cur);
- entity->retransmit_end = prev;
- cur = prev->next;
- } else {
- entity->retransmit_end = cur;
- prev = cur;
- cur = cur->next;
- }
- }
- entity->retransmit_list = head.next;
- if (entity->retransmit_list == NULL)
- entity->retransmit_end = NULL;
-
-#undef IS_BIT_SET
-#undef SET_BIT
-}
-
static int so_overlap(int s1, int e1, int s2, int e2)
{
if (s1 < s2) {
@@ -402,136 +297,375 @@ static int so_overlap(int s1, int e1, int s2, int e2)
return 0;
}
-static void process_nack_sn(nr_rlc_entity_am_t *entity, int nack_sn,
- int so_start, int so_end, unsigned char *sn_set)
-{
- /* put all SDU segments with SN == 'sn' and with an overlapping so start/end
- * to the retransmit list
- * source lists are ack list and wait list.
- * Not sure if we should consider wait list, isn't the other end supposed
- * to only NACK SNs lower than the ACK SN sent in the status PDU, in which
- * case all potential SDU segments should all be in ack list when calling
- * the current function? in doubt let's accept anything and thus process
- * also wait list.
- */
- nr_rlc_sdu_segment_t head;
- nr_rlc_sdu_segment_t *cur;
- nr_rlc_sdu_segment_t *prev;
-
-#define IS_SN_SET(b) (sn_set[(b)/8] & (1 << ((b) % 8)))
-#define SET_SN(b) do { sn_set[(b)/8] |= (1 << ((b) % 8)); } while (0)
-
- /* check that tx_next_ack <= sn < tx_next */
- if (!(sn_compare_tx(entity, entity->tx_next_ack, nack_sn) <= 0 &&
- sn_compare_tx(entity, nack_sn, entity->tx_next) < 0))
- return;
-
- /* process wait list */
- head.next = entity->wait_list;
- prev = &head;
- cur = entity->wait_list;
- while (cur != NULL) {
- if (cur->sdu->sn == nack_sn &&
- so_overlap(so_start, so_end, cur->so, cur->so + cur->size - 1)) {
- /* remove from wait list */
- prev->next = cur->next;
- cur->next = NULL;
- /* consider the SDU segment for retransmission */
- consider_retransmission(entity, cur, !IS_SN_SET(cur->sdu->sn));
- SET_SN(cur->sdu->sn);
- entity->wait_end = prev;
- cur = prev->next;
- } else {
- entity->wait_end = cur;
- prev = cur;
- cur = cur->next;
- }
- }
- entity->wait_list = head.next;
- if (entity->wait_list == NULL)
- entity->wait_end = NULL;
-
- /* process ack list */
- head.next = entity->ack_list;
- prev = &head;
- cur = entity->ack_list;
- while (cur != NULL) {
- if (cur->sdu->sn == nack_sn &&
- so_overlap(so_start, so_end, cur->so, cur->so + cur->size - 1)) {
- /* remove from ack list */
- prev->next = cur->next;
- cur->next = NULL;
- /* consider the SDU segment for retransmission */
- consider_retransmission(entity, cur, !IS_SN_SET(cur->sdu->sn));
- SET_SN(cur->sdu->sn);
- cur = prev->next;
- } else {
- prev = cur;
- cur = cur->next;
- }
- }
- entity->ack_list = head.next;
-
-#undef IS_BIT_SET
-#undef SET_BIT
-}
-
-static void process_received_nack(nr_rlc_entity_am_t *entity, int nack_sn,
- int so_start, int so_end, int range,
- unsigned char *sn_set)
+static void process_control_pdu(nr_rlc_entity_am_t *entity,
+ char *buffer, int size)
{
+#define R(d) do { if (nr_rlc_pdu_decoder_in_error(&d)) goto err; } while (0)
+ nr_rlc_pdu_decoder_t decoder;
int i;
+ int cpt;
+ int ack_sn;
+ int nack_sn;
+ int e1;
+ int e2;
+ int e3;
+ int so_start;
+ int so_end;
+ int range;
+ int prev_nack_sn = -1;
+ int prev_so_start;
+ int prev_so_end;
+ int tx_next_ack;
+ nr_rlc_sdu_segment_t *cur_wait_list;
+ nr_rlc_sdu_segment_t *prev_wait_list;
+ nr_rlc_sdu_segment_t *end_wait_list = NULL;
+ nr_rlc_sdu_segment_t head_wait_list;
+ nr_rlc_sdu_segment_t *cur_retransmit_list;
+ nr_rlc_sdu_segment_t *new_retransmit_list;
+ nr_rlc_sdu_segment_t head_retransmit_list;
- for (i = 0; i < range; i++)
- process_nack_sn(entity, (nack_sn + i) % entity->sn_modulus,
- i == 0 ? so_start : 0,
- i == range - 1 ? so_end : -1,
- sn_set);
-}
+ head_wait_list.next = entity->wait_list;
+ cur_wait_list = entity->wait_list;
+ prev_wait_list = &head_wait_list;
-static int sdu_segment_in_ack_list_full(nr_rlc_sdu_segment_t *sdu)
-{
- int target_count = sdu->sdu->ref_count;
- int actual_count = 0;
- int sn = sdu->sdu->sn;
+ head_retransmit_list.next = NULL;
+ cur_retransmit_list = entity->retransmit_list;
+ new_retransmit_list = &head_retransmit_list;
- while (sdu != NULL && sdu->sdu->sn == sn) {
- actual_count++;
- sdu = sdu->next;
+ nr_rlc_pdu_decoder_init(&decoder, buffer, size);
+ nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); /* dc */
+
+ cpt = nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder);
+ if (cpt != 0) {
+ LOG_E(RLC, "%s:%d:%s: warning: discard PDU, CPT not 0 (%d)\n",
+ __FILE__, __LINE__, __FUNCTION__, cpt);
+ goto err;
+ }
+ ack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder);
+ e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
+ /* r bits */
+ if (entity->sn_field_length == 18) {
+ nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
+ } else {
+ nr_rlc_pdu_decoder_get_bits(&decoder, 7); R(decoder);
}
- return actual_count == target_count;
-}
-
-static void finalize_ack_nack_processing(nr_rlc_entity_am_t *entity)
-{
- nr_rlc_sdu_segment_t *cur = entity->ack_list;
- int sn;
-
- /* - send indication of successful delivery for all consecutive acked SDUs
- * starting from tx_next_ack. Also free them.
- * - update tx_next_ack to the next SN not acked yet
+ /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is
+ * received for the SN 'poll_sn' - check ACK case (NACK done below)
*/
- /* todo: send indication of successful delivery as soon as possible as
- * the specs say (38.322 5.2.3.1.1). As the code is, if we receive
- * ack for SN+2 we won't indicate successful delivery before
- * SN+1 has been indicated.
+ if (sn_compare_tx(entity, entity->poll_sn, ack_sn) < 0)
+ entity->t_poll_retransmit_start = 0;
+
+ while (e1) {
+ nack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder);
+ e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
+ e2 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
+ e3 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
+ /* r bits */
+ if (entity->sn_field_length == 18) {
+ nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder);
+ } else {
+ nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
+ }
+ if (e2) {
+ so_start = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder);
+ so_end = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder);
+ } else {
+ so_start = 0;
+ so_end = 0xffff;
+ }
+ if (e3) {
+ range = nr_rlc_pdu_decoder_get_bits(&decoder, 8); R(decoder);
+ } else {
+ range = 1;
+ }
+ /* special value 0xffff indicates 'all bytes to the end' */
+ if (so_end == 0xffff)
+ so_end = -1;
+
+ /* process nacks */
+ for (i = 0; i < range; i++) {
+ int cur_nack_sn = (nack_sn + i) % entity->sn_modulus;
+ int cur_so_start = i == 0 ? so_start : 0;
+ int cur_so_end = i == range - 1 ? so_end : -1;
+
+ /* check that current nack is > previous nack and <= ack
+ * if not then skip it and all following nacks, and
+ * do not touch t_poll_retransmit
+ */
+ if (prev_nack_sn != -1) {
+ int cmp = sn_compare_tx(entity, cur_nack_sn, prev_nack_sn);
+ if (cmp < 0
+ || (cmp == 0
+ && (prev_so_end == -1
+ || cur_so_start <= prev_so_end))) {
+ LOG_E(RLC, "%s:%d:%s: bad NACK (nack sn %d so start/end %d/%d, previous nack sn %d so start/end %d/%d), skip it and all following NACKs\n",
+ __FILE__, __LINE__, __FUNCTION__,
+ cur_nack_sn, cur_so_start, cur_so_end,
+ prev_nack_sn, prev_so_start, prev_so_end);
+ goto nacks_done;
+ }
+ }
+ if (sn_compare_tx(entity, cur_nack_sn, ack_sn) > 0) {
+ LOG_E(RLC, "%s:%d:%s: bad NACK (nack %d ack %d), skip it and all following NACKs\n",
+ __FILE__, __LINE__, __FUNCTION__,
+ cur_nack_sn, ack_sn);
+ goto nacks_done;
+ }
+
+process_next_pdu:
+ /* process smallest SN either from wait_list or retransmit list */
+ if (cur_wait_list == NULL && cur_retransmit_list == NULL)
+ goto lists_over;
+ if (cur_wait_list == NULL)
+ goto process_retransmit_list_head;
+ if (cur_retransmit_list == NULL)
+ goto process_wait_list_head;
+ if (cur_wait_list->sdu->sn < cur_retransmit_list->sdu->sn
+ || (cur_wait_list->sdu->sn == cur_retransmit_list->sdu->sn &&
+ cur_wait_list->so < cur_retransmit_list->so))
+ goto process_wait_list_head;
+ goto process_retransmit_list_head;
+
+process_wait_list_head:
+ /* if nack overlaps with current segment, put it in retransmit list */
+ if (cur_wait_list->sdu->sn == cur_nack_sn
+ && so_overlap(cur_so_start, cur_so_end,
+ cur_wait_list->so,
+ cur_wait_list->so + cur_wait_list->size - 1)) {
+ prev_wait_list->next = cur_wait_list->next;
+ if (cur_wait_list == entity->wait_end)
+ end_wait_list = prev_wait_list;
+ cur_wait_list->next = NULL;
+ new_retransmit_list->next = cur_wait_list;
+ new_retransmit_list = cur_wait_list;
+ /* increase retx count. Don't care about segmentation, so maybe we
+ * increase too much.
+ */
+ cur_wait_list->sdu->retx_count++;
+ /* report max RETX reached for all retx_count >= max_retx_threshold
+ * (specs say to report if retx_count == max_retx_threshold).
+ * Upper layers should react (radio link failure), so no big deal.
+ * We deal with segmentation by requiring
+ * retx_count >= max_retx_threshold * number of segments.
+ * We may report max RETX reached too late/early. To be refined if
+ * this is a problem.
+ */
+ if (cur_wait_list->sdu->retx_count
+ >= entity->max_retx_threshold * cur_wait_list->sdu->ref_count)
+ entity->common.max_retx_reached(entity->common.max_retx_reached_data,
+ (nr_rlc_entity_t *)entity);
+ /* update buffer status */
+ entity->common.bstatus.retx_size += compute_pdu_header_size(entity, cur_wait_list)
+ + cur_wait_list->size;
+ /* and go process the next pdu, still for the current nack */
+ cur_wait_list = prev_wait_list->next;
+ goto process_next_pdu;
+ }
+
+ /* if current segment SN > current NACK, we can't classify it yet */
+ if (sn_compare_tx(entity, cur_wait_list->sdu->sn, cur_nack_sn) > 0
+ || (cur_wait_list->sdu->sn == cur_nack_sn
+ && cur_wait_list->so > cur_so_start))
+ goto done_nack;
+
+ /* if current segment is acked, free it, indicate successful delivery
+ * if fully acked
+ */
+ if (sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) < 0) {
+ nr_rlc_sdu_segment_t *cur = cur_wait_list;
+ int upper_layer_id = cur->sdu->upper_layer_id;
+ int sdu_size = cur->sdu->size;
+ cur_wait_list = cur_wait_list->next;
+ prev_wait_list->next = cur_wait_list;
+ if (cur_wait_list == entity->wait_end)
+ end_wait_list = prev_wait_list;
+ if (nr_rlc_free_sdu_segment(cur)) {
+ entity->tx_size -= sdu_size;
+ entity->common.sdu_successful_delivery(
+ entity->common.sdu_successful_delivery_data,
+ (nr_rlc_entity_t *)entity, upper_layer_id);
+ }
+ goto process_next_pdu;
+ }
+
+ /* if current segment SN > ack_sn, we're done with this list */
+ if (sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) > 0) {
+ cur_wait_list = NULL;
+ goto process_next_pdu;
+ }
+
+ /* current segment SN == ack_sn, skip this segment and move to the next.
+ * Not sure if correct, can we get a nack_sn == ack_sn? 38.322 5.3.4 says
+ * "set the ACK_SN to the SN of the next not received RLC SDU which is
+ * not indicated as missing in the resulting STATUS PDU." Is it okay to
+ * receive some NACK for a given SN and an ACK == this SN? I can see a
+ * case where it's possible (only parts of an SN were received and the
+ * TB is too small to report the several NACKs for this SN, then we
+ * can't set ACK = SN+1 but in this case, shouldn't we skip sending
+ * NACKs for this SN and only send ACK = SN? our current implementation
+ * does send both NACKs and ACK, see function generate_status()).
+ */
+ prev_wait_list = cur_wait_list;
+ cur_wait_list = cur_wait_list->next;
+ goto process_next_pdu;
+
+process_retransmit_list_head:
+ /* if nack overlaps with current segment, leave it in retransmit list */
+ if (cur_retransmit_list->sdu->sn == cur_nack_sn
+ && so_overlap(cur_so_start, cur_so_end,
+ cur_retransmit_list->so,
+ cur_retransmit_list->so + cur_retransmit_list->size - 1)) {
+ new_retransmit_list->next = cur_retransmit_list;
+ cur_retransmit_list = cur_retransmit_list->next;
+ new_retransmit_list = new_retransmit_list->next;
+ new_retransmit_list->next = NULL;
+ /* go process the next pdu, still for the current nack */
+ goto process_next_pdu;
+ }
+
+ /* if current segment SN > current NACK, we can't classify it yet */
+ if (sn_compare_tx(entity, cur_retransmit_list->sdu->sn, cur_nack_sn) > 0
+ || (cur_retransmit_list->sdu->sn == cur_nack_sn
+ && cur_retransmit_list->so > cur_so_start))
+ goto done_nack;
+
+ /* if current segment is acked, free it, indicate successful delivery
+ * if fully acked
+ */
+ if (sn_compare_tx(entity, cur_retransmit_list->sdu->sn, ack_sn) < 0) {
+ nr_rlc_sdu_segment_t *cur = cur_retransmit_list;
+ int upper_layer_id = cur->sdu->upper_layer_id;
+ int sdu_size = cur->sdu->size;
+ cur_retransmit_list = cur_retransmit_list->next;
+ /* update buffer status */
+ entity->common.bstatus.retx_size -= compute_pdu_header_size(entity, cur)
+ + cur->size;
+ if (nr_rlc_free_sdu_segment(cur)) {
+ entity->tx_size -= sdu_size;
+ entity->common.sdu_successful_delivery(
+ entity->common.sdu_successful_delivery_data,
+ (nr_rlc_entity_t *)entity, upper_layer_id);
+ }
+ goto process_next_pdu;
+ }
+
+ /* current segment SN >= ack_sn
+ * if the wait list is empty, then put the remaining retransmit list at
+ * the end of the new retransmit list (just a speedup)
+ * if not, put only this segment
+ */
+ if (cur_wait_list == NULL) {
+ new_retransmit_list->next = cur_retransmit_list;
+ cur_retransmit_list = NULL;
+ goto lists_over;
+ }
+ new_retransmit_list->next = cur_retransmit_list;
+ cur_retransmit_list = cur_retransmit_list->next;
+ new_retransmit_list = new_retransmit_list->next;
+ new_retransmit_list->next = NULL;
+ goto process_next_pdu;
+
+done_nack:
+ prev_nack_sn = cur_nack_sn;
+ prev_so_start = cur_so_start;
+ prev_so_end = cur_so_end;
+ } /* for (i = 0; i < range; i++) */
+
+lists_over:
+ /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is
+ * received for the SN 'poll_sn' - check NACK case (ACK done above)
+ */
+ if (sn_compare_tx(entity, nack_sn, entity->poll_sn) <= 0 &&
+ sn_compare_tx(entity, entity->poll_sn, (nack_sn + range) % entity->sn_modulus) < 0)
+ entity->t_poll_retransmit_start = 0;
+ } /* while (e1) */
+
+nacks_done:
+ /* nacks done, finish with ack */
+ /* we may report successful delivery out of order, if it's a problem
+ * then we can have a single loop and deal with the smallest sn of
+ * the current head of wait list and the current head of retransmit list.
+ * (It's simpler to process those two lists the one after the other.)
*/
- while (cur != NULL && cur->sdu->sn == entity->tx_next_ack &&
- sdu_segment_in_ack_list_full(cur)) {
- entity->tx_size -= cur->sdu->size;
- sn = cur->sdu->sn;
- entity->common.sdu_successful_delivery(
- entity->common.sdu_successful_delivery_data,
- (nr_rlc_entity_t *)entity, cur->sdu->upper_layer_id);
- while (cur != NULL && cur->sdu->sn == sn) {
- nr_rlc_sdu_segment_t *s = cur;
- cur = cur->next;
- nr_rlc_free_sdu_segment(s);
+ /* deal with wait list */
+ while (cur_wait_list != NULL
+ && sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) < 0) {
+ /* current segment is acked, free it, indicate successful delivery
+ * if fully acked
+ */
+ nr_rlc_sdu_segment_t *cur = cur_wait_list;
+ int upper_layer_id = cur->sdu->upper_layer_id;
+ int sdu_size = cur->sdu->size;
+ prev_wait_list->next = cur_wait_list->next;
+ if (cur_wait_list == entity->wait_end)
+ end_wait_list = prev_wait_list;
+ cur_wait_list = cur_wait_list->next;
+ if (nr_rlc_free_sdu_segment(cur)) {
+ entity->tx_size -= sdu_size;
+ entity->common.sdu_successful_delivery(
+ entity->common.sdu_successful_delivery_data,
+ (nr_rlc_entity_t *)entity, upper_layer_id);
}
- entity->ack_list = cur;
- entity->tx_next_ack = (entity->tx_next_ack + 1) % entity->sn_modulus;
}
+ /* deal with retransmit list */
+ while (cur_retransmit_list != NULL
+ && sn_compare_tx(entity, cur_retransmit_list->sdu->sn, ack_sn) < 0) {
+ /* current segment is acked, free it, indicate successful delivery
+ * if fully acked
+ */
+ nr_rlc_sdu_segment_t *cur = cur_retransmit_list;
+ int upper_layer_id = cur->sdu->upper_layer_id;
+ int sdu_size = cur->sdu->size;
+ cur_retransmit_list = cur_retransmit_list->next;
+ /* update buffer status */
+ entity->common.bstatus.retx_size -= compute_pdu_header_size(entity, cur)
+ + cur->size;
+ if (nr_rlc_free_sdu_segment(cur)) {
+ entity->tx_size -= sdu_size;
+ entity->common.sdu_successful_delivery(
+ entity->common.sdu_successful_delivery_data,
+ (nr_rlc_entity_t *)entity, upper_layer_id);
+ }
+ }
+
+ new_retransmit_list->next = cur_retransmit_list;
+
+ entity->wait_list = head_wait_list.next;
+ entity->retransmit_list = head_retransmit_list.next;
+
+ if (end_wait_list != NULL) {
+ if (end_wait_list == &head_wait_list)
+ entity->wait_end = NULL;
+ else
+ entity->wait_end = end_wait_list;
+ }
+
+ /* update tx_next_ack */
+ /* 38.322 5.2.3.1.1 says "set TX_Next_Ack equal to the SN of the RLC SDU
+ * with the smallest SN, whose SN falls within the range
+ * TX_Next_Ack <= SN <= TX_Next and for which a positive acknowledgment
+ * has not been received yet.
+ */
+ /* let's start from highest possible value and go down as needed */
+ tx_next_ack = entity->tx_next;
+ if (entity->wait_list != NULL
+ && sn_compare_tx(entity, entity->wait_list->sdu->sn, tx_next_ack) < 0)
+ tx_next_ack = entity->wait_list->sdu->sn;
+ if (entity->retransmit_list != NULL
+ && sn_compare_tx(entity, entity->retransmit_list->sdu->sn, tx_next_ack) < 0)
+ tx_next_ack = entity->retransmit_list->sdu->sn;
+ if (sn_compare_tx(entity, ack_sn, tx_next_ack) < 0)
+ tx_next_ack = ack_sn;
+ entity->tx_next_ack = tx_next_ack;
+
+ return;
+
+err:
+ LOG_E(RLC, "%s:%d:%s: error decoding PDU, NR RLC entity in inconsistent state\n",
+ __FILE__, __LINE__, __FUNCTION__);
+
+#undef R
}
void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity,
@@ -540,7 +674,6 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity,
#define R(d) do { if (nr_rlc_pdu_decoder_in_error(&d)) goto err; } while (0)
nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity;
nr_rlc_pdu_decoder_t decoder;
- nr_rlc_pdu_decoder_t control_decoder;
nr_rlc_pdu_t *pdu;
int dc;
int p = 0;
@@ -551,23 +684,11 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity,
int is_first;
int is_last;
- int cpt;
- int e1;
- int e2;
- int e3;
- int ack_sn;
- int nack_sn;
- int so_start;
- int so_end;
- int range;
- int control_e1;
- int control_e2;
- int control_e3;
- unsigned char sn_set[32768]; /* used to dec retx_count only once per sdu */
-
nr_rlc_pdu_decoder_init(&decoder, buffer, size);
dc = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
- if (dc == 0) goto control;
+
+ if (dc == 0)
+ return process_control_pdu(entity, buffer, size);
/* data PDU */
p = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
@@ -596,20 +717,20 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity,
/* dicard PDU if no data */
if (data_size <= 0) {
- LOG_W(RLC, "%s:%d:%s: warning: discard PDU, no data\n",
+ LOG_D(RLC, "%s:%d:%s: warning: discard PDU, no data\n",
__FILE__, __LINE__, __FUNCTION__);
goto discard;
}
/* dicard PDU if rx buffer is full */
if (entity->rx_size + data_size > entity->rx_maxsize) {
- LOG_W(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n",
+ LOG_D(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n",
__FILE__, __LINE__, __FUNCTION__);
goto discard;
}
if (!sn_in_recv_window(entity, sn)) {
- LOG_W(RLC, "%s:%d:%s: warning: discard PDU, sn out of window (sn %d rx_next %d)\n",
+ LOG_D(RLC, "%s:%d:%s: warning: discard PDU, sn out of window (sn %d rx_next %d)\n",
__FILE__, __LINE__, __FUNCTION__,
sn, entity->rx_next);
goto discard;
@@ -617,7 +738,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity,
/* discard segment if all the bytes of the segment are already there */
if (segment_already_received(entity, sn, so, data_size)) {
- LOG_W(RLC, "%s:%d:%s: warning: discard PDU, already received\n",
+ LOG_D(RLC, "%s:%d:%s: warning: discard PDU, already received\n",
__FILE__, __LINE__, __FUNCTION__);
goto discard;
}
@@ -650,118 +771,6 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity,
return;
-control:
- cpt = nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder);
- if (cpt != 0) {
- LOG_W(RLC, "%s:%d:%s: warning: discard PDU, CPT not 0 (%d)\n",
- __FILE__, __LINE__, __FUNCTION__, cpt);
- goto discard;
- }
- ack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder);
- e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
- /* r bits */
- if (entity->sn_field_length == 18) {
- nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
- } else {
- nr_rlc_pdu_decoder_get_bits(&decoder, 7); R(decoder);
- }
-
- /* let's try to parse the control PDU once to check consistency */
- control_decoder = decoder;
- control_e1 = e1;
- while (control_e1) {
- nack_sn = nr_rlc_pdu_decoder_get_bits(&control_decoder, entity->sn_field_length); R(control_decoder);
- control_e1 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder);
- control_e2 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder);
- control_e3 = nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder);
- /* r bits */
- if (entity->sn_field_length == 18) {
- nr_rlc_pdu_decoder_get_bits(&control_decoder, 3); R(control_decoder);
- } else {
- nr_rlc_pdu_decoder_get_bits(&control_decoder, 1); R(control_decoder);
- }
- /* check range and so_start/so_end consistency */
- if (control_e2) {
- so_start = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder);
- so_end = nr_rlc_pdu_decoder_get_bits(&control_decoder, 16); R(control_decoder);
- } else {
- so_start = 0;
- so_end = 0xffff;
- }
- if (control_e3) {
- range = nr_rlc_pdu_decoder_get_bits(&control_decoder, 8); R(control_decoder);
- } else {
- range = 1;
- }
- if (range < 1) {
- LOG_E(RLC, "%s:%d:%s: error, bad 'range' in RLC NACK (sn %d)\n",
- __FILE__, __LINE__, __FUNCTION__, nack_sn);
- goto err;
- }
- /* so_start can be > so_end if more than one range; they don't refer
- * to the same PDU then
- */
- if (range == 1 && so_end < so_start) {
- LOG_E(RLC, "%s:%d:%s: error, bad so start/end (sn %d)\n",
- __FILE__, __LINE__, __FUNCTION__, nack_sn);
- goto err;
- }
- }
-
- /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is
- * received for the SN 'poll_sn' - check ACK case (NACK done below)
- */
- if (sn_compare_tx(entity, entity->poll_sn, ack_sn) < 0)
- entity->t_poll_retransmit_start = 0;
-
- /* at this point, accept the PDU even if the actual values
- * may be incorrect (eg. if so_start > so_end)
- */
- process_received_ack(entity, ack_sn);
-
- if (e1)
- memset(sn_set, 0, 32768);
-
- while (e1) {
- nack_sn = nr_rlc_pdu_decoder_get_bits(&decoder, entity->sn_field_length); R(decoder);
- e1 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
- e2 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
- e3 = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
- /* r bits */
- if (entity->sn_field_length == 18) {
- nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder);
- } else {
- nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder);
- }
- if (e2) {
- so_start = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder);
- so_end = nr_rlc_pdu_decoder_get_bits(&decoder, 16); R(decoder);
- } else {
- so_start = 0;
- so_end = 0xffff;
- }
- if (e3) {
- range = nr_rlc_pdu_decoder_get_bits(&decoder, 8); R(decoder);
- } else {
- range = 1;
- }
- /* special value 0xffff indicates 'all bytes to the end' */
- if (so_end == 0xffff)
- so_end = -1;
- process_received_nack(entity, nack_sn, so_start, so_end, range, sn_set);
-
- /* 38.322 5.3.3.3 says to stop t_poll_retransmit if a ACK or NACK is
- * received for the SN 'poll_sn' - check NACK case (ACK done above)
- */
- if (sn_compare_tx(entity, nack_sn, entity->poll_sn) <= 0 &&
- sn_compare_tx(entity, entity->poll_sn, (nack_sn + range) % entity->sn_modulus) < 0)
- entity->t_poll_retransmit_start = 0;
- }
-
- finalize_ack_nack_processing(entity);
-
- return;
-
err:
LOG_W(RLC, "%s:%d:%s: error decoding PDU, discarding\n", __FILE__, __LINE__, __FUNCTION__);
goto discard;
@@ -908,8 +917,6 @@ typedef struct {
int so_start;
int sn_end;
int so_end;
- /* data for maximum ack */
- int ack_sn; /* -1 if not to be used */
/* pdu to use for next call to 'next_missing' */
nr_rlc_pdu_t *next;
} missing_data_t;
@@ -924,13 +931,12 @@ static missing_data_t next_missing(nr_rlc_entity_am_t *entity,
int max_so = 0;
int last_reached = 0;
- ret.ack_sn = -1;
-
/* special case: missing part before the head of RX list */
if (check_head) {
if (cur->sn != entity->rx_next || !cur->is_first) {
/* don't report if out of reporting window */
- if (sn_compare_rx(entity, entity->rx_highest_status, cur->sn) <= 0) {
+ if (sn_compare_rx(entity, entity->rx_highest_status,
+ entity->rx_next) <= 0) {
ret.sn_start = -1;
return ret;
}
@@ -954,10 +960,6 @@ next_pdu:
max_so = cur_max_so;
last_reached = last_reached | cur->is_last;
- /* if cur already processed, it can be the acked SDU */
- if (cur->data == NULL)
- ret.ack_sn = (cur->sn + 1) % entity->sn_modulus;
-
/* no next? */
if (cur->next == NULL) {
/* inform the caller that work is over */
@@ -1033,32 +1035,36 @@ next_pdu:
}
/* discontinuity between different SDUs */
- ret.sn_start = sn;
+ if (last_reached) {
+ ret.sn_start = (sn + 1) % entity->sn_modulus;
+ ret.so_start = 0;
+ } else {
+ ret.sn_start = sn;
+ ret.so_start = max_so + 1;
+ }
/* don't report if out of reporting window */
if (sn_compare_rx(entity, entity->rx_highest_status, ret.sn_start) <= 0) {
ret.sn_start = -1;
return ret;
}
- ret.so_start = max_so + 1;
set_end_different_sdu:
- /* don't go more than rx_highest_status - 1 */
- if (sn_compare_rx(entity, entity->rx_highest_status, cur->sn) <= 0) {
- ret.sn_end = (entity->rx_highest_status - 1 + entity->sn_modulus) %
- entity->sn_modulus;
- ret.so_end = 0xffff;
- return ret;
- }
-
/* if cur is the head of a SDU, then use cur-1 */
if (cur->is_first) {
ret.sn_end = (cur->sn - 1 + entity->sn_modulus) % entity->sn_modulus;
ret.so_end = 0xffff;
- return ret;
+ } else {
+ ret.sn_end = cur->sn;
+ ret.so_end = cur->so - 1;
+ }
+ /* don't go more than rx_highest_status - 1 */
+ if (sn_compare_rx(entity, entity->rx_highest_status, ret.sn_end) <= 0) {
+ ret.sn_end = (entity->rx_highest_status - 1 + entity->sn_modulus) %
+ entity->sn_modulus;
+ ret.so_end = 0xffff;
+ ret.next = NULL;
}
- ret.sn_end = cur->sn;
- ret.so_end = cur->so - 1;
return ret;
}
@@ -1098,21 +1104,20 @@ static void get_e1_position(nr_rlc_entity_am_t *entity,
}
}
-/* returns the number of nacks serialized.
- * In most cases it is 1, it can be more if the
- * missing data consists of a range that is more
- * than 255 SNs in which case it has to be cut in
- * smaller ranges.
+/* returns the last nack SN generated, -1 if nothing generated.
* If there is no more room in the status buffer,
* will set m->next = NULL (and may serialize
- * less nacks than required by 'm').
+ * less nacks than required by 'm'), also
+ * sets *generation_truncated to 1.
*/
static int generate_missing(nr_rlc_entity_am_t *entity,
nr_rlc_pdu_encoder_t *encoder,
- missing_data_t *m, int *e1_byte, int *e1_bit)
+ missing_data_t *m, int *e1_byte, int *e1_bit,
+ int *generation_truncated,
+ unsigned char **so_end_address)
{
int r_bits = entity->sn_field_length == 18 ? 3 : 1;
- int range_count = 0;
+ int last_nack_generated = -1;
int sn_start;
int so_start;
int sn_end;
@@ -1164,6 +1169,7 @@ static int generate_missing(nr_rlc_entity_am_t *entity,
m_nack.so_end = so_end;
if (encoder->byte + nack_size(entity, &m_nack) > encoder->size) {
m->next = NULL;
+ *generation_truncated = 1;
break;
}
@@ -1197,6 +1203,7 @@ static int generate_missing(nr_rlc_entity_am_t *entity,
/* nack_sn */
nr_rlc_pdu_encoder_put_bits(encoder, sn_start,
entity->sn_field_length);
+ last_nack_generated = sn_start;
/* e1 = 0 (set later if needed) */
nr_rlc_pdu_encoder_put_bits(encoder, 0, 1);
/* e2 */
@@ -1208,34 +1215,44 @@ static int generate_missing(nr_rlc_entity_am_t *entity,
/* so_start/so_end */
if (e2) {
nr_rlc_pdu_encoder_put_bits(encoder, so_start, 16);
+ *so_end_address = (unsigned char *)encoder->buffer + encoder->byte;
nr_rlc_pdu_encoder_put_bits(encoder, so_end, 16);
- }
+ } else
+ *so_end_address = NULL;
/* nack range */
- if (e3)
+ if (e3) {
nr_rlc_pdu_encoder_put_bits(encoder, cur_sn_count, 8);
+ last_nack_generated += cur_sn_count - 1;
+ }
sn_count -= cur_sn_count;
sn_start = (sn_start + cur_sn_count) % entity->sn_modulus;
- range_count++;
}
- return range_count;
+ return last_nack_generated;
}
static int generate_status(nr_rlc_entity_am_t *entity, char *buffer, int size)
{
- int ack_sn = entity->rx_next;
- missing_data_t m;
+ int last_nack;
+ int ack_sn;
+ missing_data_t m;
nr_rlc_pdu_t *cur;
- int nack_count = 0;
+ int check_head = 1;
nr_rlc_pdu_encoder_t encoder;
int e1_byte;
int e1_bit;
+ int generation_truncated;
+ int ln;
+ unsigned char *so_end_address = NULL;
/* if not enough room, do nothing */
if (size < 3)
return 0;
+ /* initial last_nack is rx_next - 1 */
+ last_nack = (entity->rx_next - 1 + entity->sn_modulus) % entity->sn_modulus;
+
nr_rlc_pdu_encoder_init(&encoder, buffer, size);
/* first 3 bytes, ack_sn and e1 will be set later */
@@ -1250,22 +1267,33 @@ static int generate_status(nr_rlc_entity_am_t *entity, char *buffer, int size)
e1_bit = entity->sn_field_length == 18 ? 1 : 7;
while (cur != NULL) {
- m = next_missing(entity, cur, nack_count == 0);
-
- /* update ack_sn if the returned value is valid */
- if (m.ack_sn != -1)
- ack_sn = m.ack_sn;
+ m = next_missing(entity, cur, check_head);
+ check_head = 0;
/* stop here if no more nack to report */
if (m.sn_start == -1)
break;
- nack_count += generate_missing(entity, &encoder, &m, &e1_byte, &e1_bit);
+ generation_truncated = 0;
+ ln = generate_missing(entity, &encoder, &m, &e1_byte, &e1_bit,
+ &generation_truncated, &so_end_address);
+ /* remember the last nack put, if any */
+ if (ln != -1)
+ last_nack = ln;
+ /* if generation was truncated and so_end was put, we force its value to
+ * 0xffff (end of SDU) because we don't know what missing nack information
+ * was supposed to be put, so we nack until the end of the PDU to be sure
+ */
+ if (generation_truncated && so_end_address != NULL) {
+ so_end_address[0] = 0xff;
+ so_end_address[1] = 0xff;
+ }
cur = m.next;
}
- /* put ack_sn */
+ /* put ack_sn, which is last_nack + 1 */
+ ack_sn = (last_nack + 1) % entity->sn_modulus;
if (entity->sn_field_length == 12) {
buffer[0] = ack_sn >> 8;
buffer[1] = ack_sn & 255;
@@ -1427,8 +1455,6 @@ static int generate_retx_pdu(nr_rlc_entity_am_t *entity, char *buffer,
return 0;
entity->retransmit_list = entity->retransmit_list->next;
- if (entity->retransmit_list == NULL)
- entity->retransmit_end = NULL;
sdu->next = NULL;
@@ -1444,15 +1470,24 @@ static int generate_retx_pdu(nr_rlc_entity_am_t *entity, char *buffer,
/* put the second SDU back at the head of the retransmit list */
next_sdu->next = entity->retransmit_list;
entity->retransmit_list = next_sdu;
- if (entity->retransmit_end == NULL)
- entity->retransmit_end = entity->retransmit_list;
/* update buffer status */
entity->common.bstatus.retx_size += compute_pdu_header_size(entity, next_sdu)
+ next_sdu->size;
}
/* put SDU/SDU segment in the wait list */
- nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu);
+ /* speedup: check end of wait list, maybe the new sdu comes after */
+ if (entity->wait_end == NULL
+ || sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) > 0
+ || (sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) == 0
+ && sdu->so > entity->wait_end->so))
+ nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu);
+ else {
+ entity->wait_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity,
+ entity->wait_list, sdu);
+ if (entity->wait_list->next == NULL)
+ entity->wait_end = entity->wait_list;
+ }
p = check_poll_after_pdu_assembly(entity);
@@ -1519,7 +1554,18 @@ static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size)
entity->tx_next = (entity->tx_next + 1) % entity->sn_modulus;
/* put SDU/SDU segment in the wait list */
- nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu);
+ /* speedup: check end of wait list, probably the new sdu comes after */
+ if (entity->wait_end == NULL
+ || sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) > 0
+ || (sn_compare_tx(entity, sdu->sdu->sn, entity->wait_end->sdu->sn) == 0
+ && sdu->so > entity->wait_end->so))
+ nr_rlc_sdu_segment_list_append(&entity->wait_list, &entity->wait_end, sdu);
+ else {
+ entity->wait_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity,
+ entity->wait_list, sdu);
+ if (entity->wait_list->next == NULL)
+ entity->wait_end = entity->wait_list;
+ }
/* polling actions for a new PDU */
entity->pdu_without_poll++;
@@ -1629,11 +1675,7 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity,
static void check_t_poll_retransmit(nr_rlc_entity_am_t *entity)
{
- nr_rlc_sdu_segment_t head;
nr_rlc_sdu_segment_t *cur;
- nr_rlc_sdu_segment_t *prev;
- int sn;
- int old_retx_count;
/* 38.322 5.3.3.4 */
/* did t_poll_retransmit expire? */
@@ -1659,74 +1701,58 @@ static void check_t_poll_retransmit(nr_rlc_entity_am_t *entity)
*/
entity->force_poll = 1;
- LOG_W(RLC, "%s:%d:%s: warning: t_poll_retransmit expired\n",
+ LOG_D(RLC, "%s:%d:%s: warning: t_poll_retransmit expired\n",
__FILE__, __LINE__, __FUNCTION__);
/* do we meet conditions of 38.322 5.3.3.4? */
if (!check_poll_after_pdu_assembly(entity))
return;
- /* search wait list for SDU with highest SN */
- /* this code may be incorrect: in LTE we had to look for PDU
- * with SN = VT(S) - 1, but for NR the specs say "highest SN among the
- * ones submitted to lower layers" not 'tx_next - 1'. So we should look
- * for the highest SN in the wait list. But that's no big deal. If the
- * program runs this code, then the connection is in a bad state and we
- * can retransmit whatever we want. At some point we will receive a status
- * report and retransmit what we really have to. Actually we could just
- * retransmit the head of wait list (the specs have this 'or').
- * (Actually, maybe this interpretation is not correct and what the code
- * does is correct. The specs are confusing.)
+ /* retransmit the head of wait list, this is the case
+ * "consider any RLC SDU which has not been positively acknowledged for
+ * retransmission" of 36.322 5.3.3.4.
+ * We don't search for the highest SN, it's simpler to just take the head
+ * of wait list. This can be changed if needed.
*/
- sn = (entity->tx_next - 1 + entity->sn_modulus) % entity->sn_modulus;
-
- head.next = entity->wait_list;
cur = entity->wait_list;
- prev = &head;
-
- while (cur != NULL) {
- if (cur->sdu->sn == sn)
- break;
- prev = cur;
- cur = cur->next;
- }
-
- /* SDU with highest SN not found? take the head of wait list */
- if (cur == NULL) {
- cur = entity->wait_list;
- prev = &head;
- sn = cur->sdu->sn;
- }
/* todo: do we need to for check cur == NULL?
* It seems that no, the wait list should not be empty here, but not sure.
*/
- old_retx_count = cur->sdu->retx_count;
+ entity->wait_list = cur->next;
+ if (entity->wait_list == NULL)
+ entity->wait_end = NULL;
- /* 38.322 says "SDU", not "SDU segment", so let's retransmit all
- * SDU segments with this SN
+ /* 38.322 says "SDU", not "SDU segment", but let's retransmit only
+ * the 'cur' SDU segment. To be changed if needed. (Maybe we have
+ * to retransmit all SDU segments with the same SN that are in the
+ * wait list.)
*/
- /* todo: maybe we could simply retransmit the current SDU segment,
- * so that we don't have to run through the full wait list.
+
+ /* increase retx count. Don't care about segmentation, so maybe we
+ * increase too much.
*/
- while (cur != NULL) {
- if (cur->sdu->sn == sn) {
- prev->next = cur->next;
- cur->next = NULL;
- /* put in retransmit list */
- consider_retransmission(entity, cur,
- old_retx_count == cur->sdu->retx_count);
- } else {
- prev = cur;
- }
- cur = prev->next;
- }
- entity->wait_list = head.next;
- /* reset wait_end (todo: optimize?) */
- entity->wait_end = entity->wait_list;
- while (entity->wait_end != NULL && entity->wait_end->next != NULL)
- entity->wait_end = entity->wait_end->next;
+ cur->sdu->retx_count++;
+ /* report max RETX reached for all retx_count >= max_retx_threshold
+ * (specs say to report if retx_count == max_retx_threshold).
+ * Upper layers should react (radio link failure), so no big deal.
+ * We deal with segmentation by requiring
+ * retx_count >= max_retx_threshold * number of segments.
+ * We may report max RETX reached too late/early. To be refined if
+ * this is a problem.
+ */
+ if (cur->sdu->retx_count
+ >= entity->max_retx_threshold * cur->sdu->ref_count)
+ entity->common.max_retx_reached(entity->common.max_retx_reached_data,
+ (nr_rlc_entity_t *)entity);
+ /* update buffer status */
+ entity->common.bstatus.retx_size += compute_pdu_header_size(entity, cur)
+ + cur->size;
+
+ /* put in retransmit list */
+ entity->retransmit_list = nr_rlc_sdu_segment_list_add(sn_compare_tx, entity,
+ entity->retransmit_list, cur);
}
static void check_t_reassembly(nr_rlc_entity_am_t *entity)
@@ -1815,6 +1841,7 @@ void nr_rlc_entity_am_discard_sdu(nr_rlc_entity_t *_entity, int sdu_id)
entity->common.bstatus.tx_size -= compute_pdu_header_size(entity, cur)
+ cur->size;
+ entity->tx_size -= cur->sdu->size;
nr_rlc_free_sdu_segment(cur);
}
@@ -1857,7 +1884,6 @@ static void clear_entity(nr_rlc_entity_am_t *entity)
nr_rlc_free_sdu_segment_list(entity->tx_list);
nr_rlc_free_sdu_segment_list(entity->wait_list);
nr_rlc_free_sdu_segment_list(entity->retransmit_list);
- nr_rlc_free_sdu_segment_list(entity->ack_list);
entity->tx_list = NULL;
entity->tx_end = NULL;
@@ -1867,9 +1893,6 @@ static void clear_entity(nr_rlc_entity_am_t *entity)
entity->wait_end = NULL;
entity->retransmit_list = NULL;
- entity->retransmit_end = NULL;
-
- entity->ack_list = NULL;
entity->common.bstatus.tx_size = 0;
entity->common.bstatus.retx_size = 0;
diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h
index 453fe87026..57ae1a3485 100644
--- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h
+++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.h
@@ -84,9 +84,6 @@ typedef struct {
nr_rlc_sdu_segment_t *wait_end;
nr_rlc_sdu_segment_t *retransmit_list;
- nr_rlc_sdu_segment_t *retransmit_end;
-
- nr_rlc_sdu_segment_t *ack_list;
} nr_rlc_entity_am_t;
void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *entity,
diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c
index ef0d52558a..ef64389ac5 100644
--- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c
+++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.c
@@ -58,14 +58,19 @@ oom:
exit(1);
}
-void nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu)
+int nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu)
{
- sdu->sdu->ref_count--;
- if (sdu->sdu->ref_count == 0) {
+ int ret = 0;
+
+ sdu->sdu->free_count++;
+ if (sdu->sdu->free_count == sdu->sdu->ref_count) {
free(sdu->sdu->data);
free(sdu->sdu);
+ ret = 1;
}
free(sdu);
+
+ return ret;
}
void nr_rlc_sdu_segment_list_append(nr_rlc_sdu_segment_t **list,
diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h
index f4585fb7d6..20cc90f185 100644
--- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h
+++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h
@@ -30,6 +30,10 @@ typedef struct nr_rlc_sdu_t {
int retx_count;
int ref_count; /* incremented each time the SDU is segmented */
+ int free_count; /* incremented each time a segment is freed
+ * when it equals ref_count we can free the SDU
+ * completely
+ */
} nr_rlc_sdu_t;
typedef struct nr_rlc_sdu_segment_t {
@@ -44,7 +48,8 @@ typedef struct nr_rlc_sdu_segment_t {
nr_rlc_sdu_segment_t *nr_rlc_new_sdu(
char *buffer, int size,
int upper_layer_id);
-void nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu);
+/* return 1 if the SDU has been freed too, 0 if not (more segments to free) */
+int nr_rlc_free_sdu_segment(nr_rlc_sdu_segment_t *sdu);
void nr_rlc_sdu_segment_list_append(nr_rlc_sdu_segment_t **list,
nr_rlc_sdu_segment_t **end,
nr_rlc_sdu_segment_t *sdu);
diff --git a/openair2/LAYER2/nr_rlc/tests/test14.txt.gz b/openair2/LAYER2/nr_rlc/tests/test14.txt.gz
index 53616dae3d..45e54651eb 100644
Binary files a/openair2/LAYER2/nr_rlc/tests/test14.txt.gz and b/openair2/LAYER2/nr_rlc/tests/test14.txt.gz differ
diff --git a/openair2/LAYER2/nr_rlc/tests/test15.txt.gz b/openair2/LAYER2/nr_rlc/tests/test15.txt.gz
index 2619436c2d..ddb895d56f 100644
Binary files a/openair2/LAYER2/nr_rlc/tests/test15.txt.gz and b/openair2/LAYER2/nr_rlc/tests/test15.txt.gz differ
diff --git a/openair2/M2AP/m2ap_MCE_defs.h b/openair2/M2AP/m2ap_MCE_defs.h
index 5267232d69..73183e89c2 100644
--- a/openair2/M2AP/m2ap_MCE_defs.h
+++ b/openair2/M2AP/m2ap_MCE_defs.h
@@ -170,7 +170,7 @@ typedef struct m2ap_MCE_instance_s {
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
int num_cc;
diff --git a/openair2/M2AP/m2ap_eNB_defs.h b/openair2/M2AP/m2ap_eNB_defs.h
index b8f7e4b3c6..0b30c33d80 100644
--- a/openair2/M2AP/m2ap_eNB_defs.h
+++ b/openair2/M2AP/m2ap_eNB_defs.h
@@ -181,7 +181,7 @@ typedef struct m2ap_eNB_instance_s {
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
int num_cc;
diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
index b7a134ae98..b8b79f8399 100644
--- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
+++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c
@@ -89,13 +89,13 @@ void nrue_init_standalone_socket(int tx_port, int rx_port)
int sd = socket(server_address.sin_family, SOCK_DGRAM, 0);
if (sd < 0)
{
- LOG_E(MAC, "Socket creation error standalone PNF\n");
+ LOG_E(NR_MAC, "Socket creation error standalone PNF\n");
return;
}
if (inet_pton(server_address.sin_family, stub_eth_params.remote_addr, &server_address.sin_addr) <= 0)
{
- LOG_E(MAC, "Invalid standalone PNF Address\n");
+ LOG_E(NR_MAC, "Invalid standalone PNF Address\n");
close(sd);
return;
}
@@ -103,7 +103,7 @@ void nrue_init_standalone_socket(int tx_port, int rx_port)
// Using connect to use send() instead of sendto()
if (connect(sd, (struct sockaddr *)&server_address, addr_len) < 0)
{
- LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno));
+ LOG_E(NR_MAC, "Connection to standalone PNF failed: %s\n", strerror(errno));
close(sd);
return;
}
@@ -129,7 +129,7 @@ void nrue_init_standalone_socket(int tx_port, int rx_port)
if (bind(sd, (struct sockaddr *)&server_address, addr_len) < 0)
{
- LOG_E(MAC, "Connection to standalone PNF failed: %s\n", strerror(errno));
+ LOG_E(NR_MAC, "Connection to standalone PNF failed: %s\n", strerror(errno));
close(sd);
return;
}
@@ -634,6 +634,7 @@ static void copy_ul_tti_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n
AssertFatal(num_pdus >= 0, "Invalid ul_tti_request number of PDUS\n");
AssertFatal(num_pdus <= sizeof(ul_tti_req->pdus_list) / sizeof(ul_tti_req->pdus_list[0]),
"Too many pdus %d in ul_tti_req\n", num_pdus);
+
if (!send_crc_ind_and_rx_ind(sfn_slot))
{
LOG_T(NR_MAC, "CRC_RX ind not sent\n");
@@ -1045,7 +1046,7 @@ void *nrue_standalone_pnf_task(void *context)
if (sem_post(&sfn_slot_semaphore) != 0)
{
- LOG_E(MAC, "sem_post() error\n");
+ LOG_E(NR_MAC, "sem_post() error\n");
abort();
}
}
@@ -1125,13 +1126,13 @@ void update_harq_status(module_id_t module_id, uint8_t harq_pid, uint8_t ack_nac
}
else {
//shouldn't get here
- LOG_E(MAC, "Trying to process acknack for an inactive harq process (%d)\n", harq_pid);
+ LOG_E(NR_MAC, "Trying to process acknack for an inactive harq process (%d)\n", harq_pid);
}
}
int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
- NR_UE_L2_STATE_t ret;
+ NR_UE_L2_STATE_t ret=0;
module_id_t module_id = ul_info->module_id;
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
@@ -1183,6 +1184,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
} else {
// UL indication after reception of DCI or DL PDU
if (dl_info && dl_info->dci_ind && dl_info->dci_ind->number_of_dcis) {
+
LOG_T(MAC,"[L2][IF MODULE][DL INDICATION][DCI_IND]\n");
for (int i = 0; i < dl_info->dci_ind->number_of_dcis; i++) {
LOG_T(MAC,">>>NR_IF_Module i=%d, dl_info->dci_ind->number_of_dcis=%d\n",i,dl_info->dci_ind->number_of_dcis);
@@ -1198,8 +1200,8 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
/* The check below filters out UL_DCIs (format 7) which are being processed as DL_DCIs. */
if (dci_index->dci_format == 7 && mac->ra.ra_state == RA_SUCCEEDED) {
- LOG_T(NR_MAC, "We are filtering a UL_DCI to prevent it from being treated like a DL_DCI\n");
- break;
+ LOG_D(NR_MAC, "We are filtering a UL_DCI to prevent it from being treated like a DL_DCI\n");
+ continue;
}
dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci_index->dci_format];
g_harq_pid = def_dci_pdu_rel15->harq_pid;
@@ -1222,7 +1224,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
for (int i=0; irx_ind->number_pdus; ++i) {
- LOG_T(MAC, "In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n",
+ LOG_D(NR_MAC, "In %s sending DL indication to MAC. 1 PDU type %d of %d total number of PDUs \n",
__FUNCTION__,
dl_info->rx_ind->rx_indication_body[i].pdu_type,
dl_info->rx_ind->number_pdus);
diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c
index b46bba2492..9b37853ed2 100644
--- a/openair2/RRC/LTE/rrc_UE.c
+++ b/openair2/RRC/LTE/rrc_UE.c
@@ -3175,7 +3175,8 @@ int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index,
const size_t num_plmn_data = sizeof(plmn_data) / sizeof(plmn_data[0]);
for (size_t plmn_ind = 0;; ++plmn_ind) {
if (plmn_ind == num_plmn_data) {
- LOG_E( RRC, "Did not find name from internal table for %u %u\n", mcc, mnc);
+ LOG_W( RRC, "Did not find operator name from internal table for MCC %0*d, MNC %0*d\n",
+ mccdigits, mcc, mncdigits, mnc);
break;
}
if ((plmn_data[plmn_ind].mcc == mcc) && (plmn_data[plmn_ind].mnc == mnc)) {
diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c
index 9b9e267828..f24c9ab1b6 100644
--- a/openair2/RRC/LTE/rrc_eNB_S1AP.c
+++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c
@@ -1757,7 +1757,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance
&& RC.rrc[instance]->configuration.mnc[j] == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc
&& RC.rrc[instance]->configuration.tac == S1AP_PAGING_IND(msg_p).tac[tai_size]) {
for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
- lte_frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type;
+ frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type;
/* get nB from configuration */
/* get default DRX cycle from configuration */
Tc = (uint8_t)RC.rrc[instance]->configuration.radioresourceconfig[CC_id].pcch_defaultPagingCycle;
diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c
index bb2a180146..54fb5a168b 100644
--- a/openair2/RRC/NR/nr_rrc_config.c
+++ b/openair2/RRC/NR/nr_rrc_config.c
@@ -216,7 +216,7 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap,
void nr_rrc_config_dl_tda(NR_ServingCellConfigCommon_t *scc){
- lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
+ frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
int curr_bwp = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth;
// coreset duration setting to be improved in the framework of RRC harmonization, potentially using a common function
int len_coreset = 1;
@@ -253,7 +253,7 @@ void nr_rrc_config_ul_tda(NR_ServingCellConfigCommon_t *scc, int min_fb_delay){
uint8_t DELTA[4]= {2,3,4,6}; // Delta parameter for Msg3
int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
- lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
+ frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
struct NR_PUSCH_TimeDomainResourceAllocation *pusch_timedomainresourceallocation = CALLOC(1,sizeof(struct NR_PUSCH_TimeDomainResourceAllocation));
pusch_timedomainresourceallocation->k2 = CALLOC(1,sizeof(long));
diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c
index 4492380d7f..c73c3d9649 100644
--- a/openair2/RRC/NR/rrc_gNB_NGAP.c
+++ b/openair2/RRC/NR/rrc_gNB_NGAP.c
@@ -969,9 +969,9 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(
uint16_t ue_initial_id;
uint32_t gNB_ue_ngap_id;
rrc_gNB_ue_context_t *ue_context_p = NULL;
- protocol_ctxt_t ctxt;
- gtpv1u_gnb_create_tunnel_req_t create_tunnel_req;
- gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp;
+ protocol_ctxt_t ctxt={0};
+ gtpv1u_gnb_create_tunnel_req_t create_tunnel_req={0};
+ gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp={0};
uint8_t pdu_sessions_done;
uint8_t inde_list[NR_NB_RB_MAX - 3]= {0};
int ret = 0;
diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c
index 36113fb7ee..4e9245cf46 100644
--- a/openair2/RRC/NR/rrc_gNB_reconfig.c
+++ b/openair2/RRC/NR/rrc_gNB_reconfig.c
@@ -223,7 +223,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL;
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition));
- *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0;
+ *secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1;
secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*secondaryCellGroup->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->tci_StatesToAddModList));
@@ -572,7 +572,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS=NULL;
}
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition));
- *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos0;
+ *bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NR_DMRS_DownlinkConfig__dmrs_AdditionalPosition_pos1;
bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList=calloc(1,sizeof(*bwp->bwp_Dedicated->pdsch_Config->choice.setup->tci_StatesToAddModList));
diff --git a/openair2/UTIL/OCG/OCG.h b/openair2/UTIL/OCG/OCG.h
index 58cc7184e7..452581bb17 100644
--- a/openair2/UTIL/OCG/OCG.h
+++ b/openair2/UTIL/OCG/OCG.h
@@ -700,7 +700,7 @@ typedef struct {
unsigned int n_frames_flag; // if set, then let the emulation goes to infinity
node_function_t node_function[MAX_NUM_CCs];
node_timing_t node_timing[MAX_NUM_CCs];
- unsigned char frame_type[MAX_NUM_CCs]; //! LTE frame type (TDD=1, FDD=0). \note this should be converted to \ref lte_frame_type_t (header file reorganization needed)
+ unsigned char frame_type[MAX_NUM_CCs]; //! LTE frame type (TDD=1, FDD=0). \note this should be converted to \ref frame_type_t (header file reorganization needed)
char *frame_type_name[MAX_NUM_CCs];
unsigned char tdd_config[MAX_NUM_CCs];
unsigned char tdd_config_S[MAX_NUM_CCs];
diff --git a/openair2/X2AP/x2ap_eNB_defs.h b/openair2/X2AP/x2ap_eNB_defs.h
index 063302d03a..bd6092e0cb 100644
--- a/openair2/X2AP/x2ap_eNB_defs.h
+++ b/openair2/X2AP/x2ap_eNB_defs.h
@@ -172,7 +172,7 @@ typedef struct x2ap_eNB_instance_s {
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
uint32_t subframeAssignment[MAX_NUM_CCs];
diff --git a/openair3/M3AP/m3ap_MCE_defs.h b/openair3/M3AP/m3ap_MCE_defs.h
index 18ad70a408..4dcb2b4db0 100644
--- a/openair3/M3AP/m3ap_MCE_defs.h
+++ b/openair3/M3AP/m3ap_MCE_defs.h
@@ -170,7 +170,7 @@ typedef struct m3ap_MCE_instance_s {
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
int num_cc;
diff --git a/openair3/M3AP/m3ap_MME_defs.h b/openair3/M3AP/m3ap_MME_defs.h
index 3b5725655d..6608587cc3 100644
--- a/openair3/M3AP/m3ap_MME_defs.h
+++ b/openair3/M3AP/m3ap_MME_defs.h
@@ -170,7 +170,7 @@ typedef struct m3ap_MME_instance_s {
int32_t uplink_frequency_offset[MAX_NUM_CCs];
uint32_t Nid_cell[MAX_NUM_CCs];
int16_t N_RB_DL[MAX_NUM_CCs];
- lte_frame_type_t frame_type[MAX_NUM_CCs];
+ frame_type_t frame_type[MAX_NUM_CCs];
uint32_t fdd_earfcn_DL[MAX_NUM_CCs];
uint32_t fdd_earfcn_UL[MAX_NUM_CCs];
int num_cc;
diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c
index 283f3b7311..e151fec9b4 100644
--- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c
+++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c
@@ -428,7 +428,7 @@ void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id) {
size += 10;
// encode the message
- initialNasMsg->data = (Byte_t *)malloc(size * sizeof(Byte_t));
+ initialNasMsg->data = malloc16_clear(size * sizeof(Byte_t));
registration_request_buf = initialNasMsg->data;
initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t*)(initialNasMsg->data), size);
diff --git a/targets/ARCH/rfsimulator/apply_channelmod.c b/targets/ARCH/rfsimulator/apply_channelmod.c
index d7d3a68965..4ff5321e4d 100644
--- a/targets/ARCH/rfsimulator/apply_channelmod.c
+++ b/targets/ARCH/rfsimulator/apply_channelmod.c
@@ -52,7 +52,8 @@
either we regenerate the channel (call again random_channel(desc,0)), or we keep it over subframes
legacy: we regenerate each sub frame in UL, and each frame only in DL
*/
-void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_sig,
+void rxAddInput( const c16_t *input_sig,
+ c16_t *after_channel_sig,
int rxAnt,
channel_desc_t *channelDesc,
int nbSamples,
@@ -73,7 +74,7 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si
const int nbTx=channelDesc->nb_tx;
for (int i=0; i<((int)nbSamples-dd); i++) {
- struct complex16 *out_ptr=after_channel_sig+dd+i;
+ c16_t *out_ptr=after_channel_sig+dd+i;
struct complexd rx_tmp= {0};
for (int txAnt=0; txAnt < nbTx; txAnt++) {
@@ -87,7 +88,7 @@ void rxAddInput( struct complex16 *input_sig, struct complex16 *after_channel_si
// but it is not very usefull
// it would be better to split out each antenna in a separate flow
// that will allow to mix ru antennas freely
- struct complex16 tx16=input_sig[((TS+i-l)*nbTx+txAnt)%CirSize];
+ c16_t tx16=input_sig[((TS+i-l)*nbTx+txAnt)%CirSize];
rx_tmp.r += tx16.r * channelModel[l].r - tx16.i * channelModel[l].i;
rx_tmp.i += tx16.i * channelModel[l].r + tx16.r * channelModel[l].i;
} //l
diff --git a/targets/ARCH/rfsimulator/rfsimulator.h b/targets/ARCH/rfsimulator/rfsimulator.h
index 292873032e..e69d41fa6c 100644
--- a/targets/ARCH/rfsimulator/rfsimulator.h
+++ b/targets/ARCH/rfsimulator/rfsimulator.h
@@ -25,8 +25,8 @@
#define __RFSIMULATOR_H
double gaussZiggurat(double mean, double variance);
void tableNor(unsigned long seed);
-void rxAddInput( struct complex16 *input_sig,
- struct complex16 *after_channel_sig,
+void rxAddInput( const c16_t *input_sig,
+ c16_t *after_channel_sig,
int rxAnt,
channel_desc_t *channelDesc,
int nbSamples,
diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c
index 24a0348d35..bc9882b4bd 100644
--- a/targets/ARCH/rfsimulator/simulator.c
+++ b/targets/ARCH/rfsimulator/simulator.c
@@ -100,7 +100,7 @@ static telnetshell_vardef_t rfsimu_vardef[] = {
};
pthread_mutex_t Sockmutex;
-typedef struct complex16 sample_t; // 2*16 bits complex number
+typedef c16_t sample_t; // 2*16 bits complex number
typedef struct buffer_s {
int conn_sock;
@@ -117,7 +117,7 @@ typedef struct buffer_s {
typedef struct {
int listen_sock, epollfd;
- openair0_timestamp nextTimestamp;
+ openair0_timestamp nextRxTstamp;
openair0_timestamp lastWroteTS;
uint64_t typeStamp;
char *ip;
@@ -196,7 +196,7 @@ static void removeCirBuf(rfsimulator_state_t *bridge, int sock) {
free(bridge->buf[sock].circularBuf);
// Fixme: no free_channel_desc_scm(bridge->buf[sock].channel_model) implemented
// a lot of mem leaks
- free(bridge->buf[sock].channel_model);
+ //free(bridge->buf[sock].channel_model);
memset(&bridge->buf[sock], 0, sizeof(buffer_t));
bridge->buf[sock].conn_sock=-1;
}
@@ -429,8 +429,6 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp
if (!alreadyLocked)
pthread_mutex_lock(&Sockmutex);
- LOG_D(HW,"sending %d samples at time: %ld\n", nsamps, timestamp);
-
for (int i=0; ibuf[i];
@@ -495,7 +493,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
setblocking(conn_sock, notBlocking);
allocCirBuf(t, conn_sock);
LOG_I(HW,"A client connected, sending the current time\n");
- struct complex16 v= {0};
+ c16_t v= {0};
void *samplesVoid[t->tx_num_channels];
for ( int i=0; i < t->tx_num_channels; i++)
@@ -549,14 +547,14 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
(t->typeStamp == ENB_MAGICDL && b->th.magic==UE_MAGICDL), "Socket Error in protocol");
b->headerMode=false;
- if ( t->nextTimestamp == 0 ) { // First block in UE, resync with the eNB current TS
- t->nextTimestamp=b->th.timestamp> nsamps_for_initial ?
+ if ( t->nextRxTstamp == 0 ) { // First block in UE, resync with the eNB current TS
+ t->nextRxTstamp=b->th.timestamp> nsamps_for_initial ?
b->th.timestamp - nsamps_for_initial :
0;
b->lastReceivedTS=b->th.timestamp> nsamps_for_initial ?
b->th.timestamp :
nsamps_for_initial;
- LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextTimestamp);
+ LOG_W(HW,"UE got first timestamp: starting at %lu\n", t->nextRxTstamp);
b->trashingPacket=true;
} else if ( b->lastReceivedTS < b->th.timestamp) {
int nbAnt= b->th.nbAnt;
@@ -623,7 +621,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
}
rfsimulator_state_t *t = device->priv;
- LOG_D(HW, "Enter rfsimulator_read, expect %d samples, will release at TS: %ld\n", nsamps, t->nextTimestamp+nsamps);
+ LOG_D(HW, "Enter rfsimulator_read, expect %d samples, will release at TS: %ld\n", nsamps, t->nextRxTstamp+nsamps);
// deliver data from received data
// check if a UE is connected
int first_sock;
@@ -634,54 +632,22 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
if ( first_sock == FD_SETSIZE ) {
// no connected device (we are eNB, no UE is connected)
- if ( t->nextTimestamp == 0)
+ if ( t->nextRxTstamp == 0)
LOG_W(HW,"No connected device, generating void samples...\n");
if (!flushInput(t, 10, nsamps)) {
for (int x=0; x < nbAnt; x++)
memset(samplesVoid[x],0,sampleToByte(nsamps,1));
- t->nextTimestamp+=nsamps;
+ t->nextRxTstamp+=nsamps;
- if ( ((t->nextTimestamp/nsamps)%100) == 0)
- LOG_D(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextTimestamp);
+ if ( ((t->nextRxTstamp/nsamps)%100) == 0)
+ LOG_D(HW,"No UE, Generated void samples for Rx: %ld\n", t->nextRxTstamp);
- *ptimestamp = t->nextTimestamp-nsamps;
+ *ptimestamp = t->nextRxTstamp-nsamps;
return nsamps;
}
} else {
- pthread_mutex_lock(&Sockmutex);
-
- if ( t->nextTimestamp > 0 && t->lastWroteTS < t->nextTimestamp) {
- pthread_mutex_unlock(&Sockmutex);
- usleep(10000);
- pthread_mutex_lock(&Sockmutex);
-
- if ( t->lastWroteTS < t->nextTimestamp ) {
- // Assuming Tx is not done fully in another thread
- // We can never write is the past from the received time
- // So, the node perform receive but will never write these symbols
- // let's tell this to the opposite node
- // We send timestamp for nb samples required
- // assuming this should have been done earlier if a Tx would exist
- pthread_mutex_unlock(&Sockmutex);
- struct complex16 v= {0};
- void *dummyS[t->tx_num_channels];
-
- for ( int i=0; i < t->tx_num_channels; i++)
- dummyS[i]=(void *)&v;
-
- LOG_I(HW, "No samples Tx occured, so we send 1 sample to notify it: Tx:%lu, Rx:%lu\n",
- t->lastWroteTS, t->nextTimestamp);
- rfsimulator_write_internal(t, t->nextTimestamp,
- dummyS, 1,
- t->tx_num_channels, 1, true);
- } else {
- pthread_mutex_unlock(&Sockmutex);
- LOG_W(HW, "trx_write came from another thread\n");
- }
- } else
- pthread_mutex_unlock(&Sockmutex);
bool have_to_wait;
@@ -692,7 +658,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
buffer_t *b=&t->buf[sock];
if ( b->circularBuf )
- if ( t->nextTimestamp+nsamps > b->lastReceivedTS ) {
+ if ( t->nextRxTstamp+nsamps > b->lastReceivedTS ) {
have_to_wait=true;
break;
}
@@ -701,7 +667,7 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
if (have_to_wait)
/*printf("Waiting on socket, current last ts: %ld, expected at least : %ld\n",
ptr->lastReceivedTS,
- t->nextTimestamp+nsamps);
+ t->nextRxTstamp+nsamps);
*/
flushInput(t, 3, nsamps);
} while (have_to_wait);
@@ -728,11 +694,11 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
for (int a=0; achannel_model != NULL ) // apply a channel model
- rxAddInput( ptr->circularBuf, (struct complex16 *) samplesVoid[a],
+ rxAddInput( ptr->circularBuf, (c16_t *) samplesVoid[a],
a,
ptr->channel_model,
nsamps,
- t->nextTimestamp,
+ t->nextRxTstamp,
CirSize
);
else { // no channel modeling
@@ -747,8 +713,8 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
//LOG_I(HW, "nbAnt_tx %d\n",nbAnt_tx);
for (int i=0; i < nsamps; i++) {//loop over nsamps
for (int a_tx=0; a_txcircularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]);
- out[i].i += (short)(ptr->circularBuf[((t->nextTimestamp+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]);
+ out[i].r += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].r*H_awgn_mimo[a][a_tx]);
+ out[i].i += (short)(ptr->circularBuf[((t->nextRxTstamp+i)*nbAnt_tx+a_tx)%CirSize].i*H_awgn_mimo[a][a_tx]);
} // end for a_tx
} // end for i (number of samps)
} // end of no channel modeling
@@ -756,11 +722,11 @@ static int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimest
}
}
- *ptimestamp = t->nextTimestamp; // return the time of the first sample
- t->nextTimestamp+=nsamps;
+ *ptimestamp = t->nextRxTstamp; // return the time of the first sample
+ t->nextRxTstamp+=nsamps;
LOG_D(HW,"Rx to upper layer: %d from %ld to %ld, energy in first antenna %d\n",
nsamps,
- *ptimestamp, t->nextTimestamp,
+ *ptimestamp, t->nextRxTstamp,
signal_energy(samplesVoid[0], nsamps));
return nsamps;
}
diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index 66ce6ef247..cee15ef48b 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -733,7 +733,7 @@ void tx_rf(RU_t *ru,
int sf_extension = 0;
if ((SF_type == SF_DL) ||
- (SF_type == SF_S)) {
+ (SF_type == SF_S) ) {
int siglen=fp->samples_per_tti,flags=1;
if (SF_type == SF_S) {
@@ -831,6 +831,23 @@ void tx_rf(RU_t *ru,
late_control=STATE_BURST_TERMINATE;
LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs, siglen,late_control);
}
+ } else if (IS_SOFTMODEM_RFSIM ) {
+ // in case of rfsim, we always enable tx because we need to feed rx of the opposite side
+ // we write 1 single I/Q sample to trigger Rx (rfsim will fill gaps with 0 I/Q)
+ void *dummy_tx[ru->frame_parms->nb_antennas_tx];
+ int16_t dummy_tx_data[ru->frame_parms->nb_antennas_tx][2]; // 2 because the function we call use pairs of int16_t implicitly as complex numbers
+ memset(dummy_tx_data,0,sizeof(dummy_tx_data));
+ for (int i=0; iframe_parms->nb_antennas_tx; i++)
+ dummy_tx[i]= dummy_tx_data[i];
+
+ AssertFatal( 1 ==
+ ru->rfdevice.trx_write_func(&ru->rfdevice,
+ timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension,
+ dummy_tx,
+ 1,
+ ru->frame_parms->nb_antennas_tx,
+ 4),"");
+
}
}
diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h
index 0267ad8ce0..1c887dd3c8 100644
--- a/targets/RT/USER/lte-softmodem.h
+++ b/targets/RT/USER/lte-softmodem.h
@@ -49,7 +49,6 @@
{"debug-ue-prach", CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"no-L2-connect", CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{"calib-prach-tx", CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
- {"loop-memory", CONFIG_HLP_UELOOP, 0, strptr:&loopfile, defstrval:"iqs.in", TYPE_STRING,0}, \
{"ue-dump-frame", CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
}
#define CMDLINE_CALIBUERX_IDX 0
diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c
index 9010a40bf9..0658b8b9d0 100644
--- a/targets/RT/USER/lte-ue.c
+++ b/targets/RT/USER/lte-ue.c
@@ -87,15 +87,12 @@ extern void multicast_link_start(void (*rx_handlerP) (unsigned int, char *),
extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP);
-int tx_req_num_elems;
+int tx_req_num_elems;
extern uint16_t sf_ahead;
//extern int tx_req_UE_MAC1();
void ue_stub_rx_handler(unsigned int, char *);
-int32_t **rxdata;
-int32_t **txdata;
-
int timer_subframe = 0;
int timer_frame = 0;
SF_ticking *phy_stub_ticking = NULL;
@@ -111,7 +108,7 @@ typedef struct eutra_band_s {
uint32_t ul_max;
uint32_t dl_min;
uint32_t dl_max;
- lte_frame_type_t frame_type;
+ frame_type_t frame_type;
} eutra_band_t;
typedef struct band_info_s {
@@ -176,6 +173,7 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
{
PHY_VARS_UE *ue = (PHY_VARS_UE *)calloc(1,sizeof(PHY_VARS_UE));
AssertFatal(ue,"");
+
if (frame_parms!=(LTE_DL_FRAME_PARMS *)NULL) { // if we want to give initial frame parms, allocate the PHY_VARS_UE structure and put them in
memcpy(&(ue->frame_parms), frame_parms, sizeof(LTE_DL_FRAME_PARMS));
}
@@ -204,8 +202,7 @@ void init_thread(int sched_runtime,
int sched_deadline,
int sched_fifo,
cpu_set_t *cpuset,
- char *name)
-{
+ char *name) {
#ifdef DEADLINE_SCHEDULER
if (sched_runtime!=0) {
@@ -266,8 +263,7 @@ void init_UE(int nb_inst,
runmode_t mode,
int rxgain,
int txpowermax,
- LTE_DL_FRAME_PARMS *fp0)
-{
+ LTE_DL_FRAME_PARMS *fp0) {
PHY_VARS_UE *UE;
int inst;
int ret;
@@ -283,9 +279,7 @@ void init_UE(int nb_inst,
if (PHY_vars_UE_g[inst]==NULL) PHY_vars_UE_g[inst] = (PHY_VARS_UE **)calloc(1+MAX_NUM_CCs,sizeof(PHY_VARS_UE *));
LOG_I(PHY,"Allocating UE context %d\n",inst);
-
PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0);
-
// turn off timing control loop in UE
PHY_vars_UE_g[inst][0]->no_timing_correction = timing_correction;
UE = PHY_vars_UE_g[inst][0];
@@ -362,7 +356,6 @@ void init_UE(int nb_inst,
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
init_UE_threads(inst);
-
ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]);
if (ret !=0) {
@@ -385,8 +378,7 @@ void init_UE(int nb_inst,
void init_UE_stub_single_thread(int nb_inst,
int eMBMS_active,
int uecap_xer_in,
- char *emul_iface)
-{
+ char *emul_iface) {
int inst;
LOG_I(PHY,"UE : Calling Layer 2 for initialization, nb_inst: %d \n", nb_inst);
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
@@ -411,24 +403,23 @@ void init_UE_stub_single_thread(int nb_inst,
}
}
-void init_UE_standalone_thread(int ue_idx)
-{
+void init_UE_standalone_thread(int ue_idx) {
int standalone_tx_port = 3211 + ue_idx * 2;
int standalone_rx_port = 3212 + ue_idx * 2;
ue_init_standalone_socket(standalone_tx_port, standalone_rx_port);
-
pthread_t thread;
+
if (pthread_create(&thread, NULL, ue_standalone_pnf_task, NULL) != 0) {
LOG_E(MAC, "pthread_create failed for calling ue_standalone_pnf_task");
}
+
pthread_setname_np(thread, "oai:ue-stand");
}
void init_UE_stub(int nb_inst,
int eMBMS_active,
int uecap_xer_in,
- char *emul_iface)
-{
+ char *emul_iface) {
int inst;
LOG_I(PHY,"UE : Calling Layer 2 for initialization\n");
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
@@ -462,8 +453,7 @@ void init_UE_stub(int nb_inst,
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
-static void *UE_thread_synch(void *arg)
-{
+static void *UE_thread_synch(void *arg) {
static int UE_thread_synch_retval;
int i ;
PHY_VARS_UE *UE = (PHY_VARS_UE *) arg;
@@ -478,6 +468,7 @@ static void *UE_thread_synch(void *arg)
printf("UE_thread_sync in with PHY_vars_UE %p\n",arg);
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
+
if ( threads.sync != -1 )
CPU_SET(threads.sync, &cpuset);
@@ -757,8 +748,7 @@ static void *UE_thread_synch(void *arg)
* \param arg is a pointer to a \ref PHY_VARS_UE structure.
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
-const char *get_connectionloss_errstr(int errcode)
-{
+const char *get_connectionloss_errstr(int errcode) {
switch (errcode) {
case CONNECTION_LOST:
return "RRC Connection lost, returning to PRACH";
@@ -773,8 +763,7 @@ const char *get_connectionloss_errstr(int errcode)
return "UNKNOWN RETURN CODE";
}
-static void *UE_thread_rxn_txnp4(void *arg)
-{
+static void *UE_thread_rxn_txnp4(void *arg) {
static __thread int UE_thread_rxtx_retval;
struct rx_tx_thread_data *rtd = arg;
UE_rxtx_proc_t *proc = rtd->proc;
@@ -867,13 +856,11 @@ static void *UE_thread_rxn_txnp4(void *arg)
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) )
- if (UE->mode != loop_through_memory)
- phy_procedures_UE_TX(UE,proc,0,0,UE->mode);
+ phy_procedures_UE_TX(UE,proc,0,0,UE->mode);
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_S) &&
(UE->frame_parms.frame_type == TDD))
- if (UE->mode != loop_through_memory)
- phy_procedures_UE_S_TX(UE,0,0);
+ phy_procedures_UE_S_TX(UE,0,0);
proc->instance_cnt_rxtx--;
@@ -895,8 +882,7 @@ static void *UE_thread_rxn_txnp4(void *arg)
unsigned int emulator_absSF;
void ue_stub_rx_handler(unsigned int num_bytes,
- char *rx_buffer)
-{
+ char *rx_buffer) {
PHY_VARS_UE *UE;
UE = PHY_vars_UE_g[0][0];
UE_tport_t *pdu = (UE_tport_t *)rx_buffer;
@@ -951,14 +937,14 @@ void ue_stub_rx_handler(unsigned int num_bytes,
}
}
-uint64_t clock_usec(void)
-{
- struct timespec t;
- if (clock_gettime(CLOCK_MONOTONIC, &t) == -1)
- {
- abort();
- }
- return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000);
+uint64_t clock_usec(void) {
+ struct timespec t;
+
+ if (clock_gettime(CLOCK_MONOTONIC, &t) == -1) {
+ abort();
+ }
+
+ return (uint64_t)t.tv_sec * 1000000 + (t.tv_nsec / 1000);
}
/*!
* \brief This is the UE thread for RX subframe n and TX subframe n+4.
@@ -968,23 +954,21 @@ uint64_t clock_usec(void)
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
-static void *UE_phy_stub_standalone_pnf_task(void *arg)
-{
+static void *UE_phy_stub_standalone_pnf_task(void *arg) {
#if 1
{
struct sched_param sparam =
{
.sched_priority = 79,
};
- if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0)
- {
+
+ if (pthread_setschedparam(pthread_self(), SCHED_RR, &sparam) != 0) {
LOG_E(PHY,"pthread_setschedparam: %s\n", strerror(errno));
}
}
#else
thread_top_init("UE_phy_stub_thread_rxn_txnp4", 1, 870000L, 1000000L, 1000000L);
#endif
-
// for multipule UE's L2-emulator
//module_id_t Mod_id = 0;
//int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames
@@ -1004,9 +988,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
PHY_VARS_UE *UE = NULL;
int ret;
proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0];
-
UE = rtd->UE;
-
UL_INFO = (UL_IND_t *)calloc(1, sizeof(UL_IND_t));
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NFAPI_RX_IND_MAX_PDU, sizeof(nfapi_rx_indication_pdu_t));
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
@@ -1019,19 +1001,15 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NFAPI_CQI_IND_MAX_PDU, sizeof(nfapi_cqi_indication_raw_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
-
proc->subframe_rx = proc->sub_frame_start;
proc->subframe_tx = -1;
proc->frame_rx = -1;
proc->frame_tx = -1;
// Initializations for nfapi-L2-emulator mode
sync_var = 0;
-
//PANOS: CAREFUL HERE!
wait_sync("UE_phy_stub_standalone_pnf_task");
-
int last_sfn_sf = -1;
-
LOG_I(MAC, "Clearing Queues\n");
reset_queue(&dl_config_req_tx_req_queue);
reset_queue(&ul_config_req_queue);
@@ -1039,72 +1017,77 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
while (!oai_exit) {
bool sent_any = false;
+
if (sem_wait(&sfn_semaphore) != 0) {
LOG_E(MAC, "sem_wait() error\n");
abort();
}
int sfn_sf = current_sfn_sf;
- if (sfn_sf == last_sfn_sf)
- {
+
+ if (sfn_sf == last_sfn_sf) {
LOG_W(MAC, "repeated sfn_sf = %d.%d\n",
sfn_sf >> 4, sfn_sf & 15);
continue;
}
- last_sfn_sf = sfn_sf;
+ last_sfn_sf = sfn_sf;
nfapi_dl_config_req_tx_req_t *dl_config_req_tx_req = get_queue(&dl_config_req_tx_req_queue);
nfapi_ul_config_request_t *ul_config_req = get_queue(&ul_config_req_queue);
nfapi_hi_dci0_request_t *hi_dci0_req = get_queue(&hi_dci0_req_queue);
-
LOG_I(MAC, "received from proxy frame %d subframe %d\n",
NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
if (ul_config_req != NULL) {
uint8_t ul_num_pdus = ul_config_req->ul_config_request_body.number_of_pdus;
+
if (ul_num_pdus > 0) {
char *ul_str = nfapi_ul_config_req_to_string(ul_config_req);
LOG_I(MAC, "ul_config_req: %s\n", ul_str);
free(ul_str);
}
}
+
if (hi_dci0_req != NULL) {
LOG_D(MAC, "hi_dci0_req pdus: %u Frame: %d Subframe: %d\n",
- hi_dci0_req->hi_dci0_request_body.number_of_dci,
- NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf));
+ hi_dci0_req->hi_dci0_request_body.number_of_dci,
+ NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf), NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf));
}
if (dl_config_req_tx_req != NULL) {
-
nfapi_tx_req_pdu_list_t *tx_req_pdu_list = dl_config_req_tx_req->tx_req_pdu_list;
nfapi_dl_config_request_t *dl_config_req = dl_config_req_tx_req->dl_config_req;
-
uint16_t dl_num_pdus = dl_config_req->dl_config_request_body.number_pdu;
LOG_I(MAC, "(OAI UE) Received dl_config_req from proxy at Frame: %d, Subframe: %d,"
" with number of PDUs: %u\n",
NFAPI_SFNSF2SFN(dl_config_req->sfn_sf), NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
dl_num_pdus);
+
if (dl_num_pdus > 0) {
char *dl_str = nfapi_dl_config_req_to_string(dl_config_req);
LOG_I(MAC, "dl_config_req: %s\n", dl_str);
free(dl_str);
}
- LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus);
+ LOG_D(MAC, "tx_req pdus: %d\n", tx_req_pdu_list->num_pdus);
// Handling dl_config_req and tx_req:
nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body;
+
for (int i = 0; i < dl_config_req_body->number_pdu; ++i) {
nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i];
+
if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
i += 1;
AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu,
"Need PDU following DCI at index %d, but not found\n",
i);
nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i];
+
if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
LOG_E(MAC, "expected DLSCH PDU at index %d\n", i);
continue;
}
+
dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu,
@@ -1125,8 +1108,10 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
}
}
}
+
if (hi_dci0_req) {
nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body;
+
for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) {
nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i];
hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf),
@@ -1139,13 +1124,13 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
for (ue_index = 0; ue_index < ue_num; ue_index++) {
ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; // Always 0 in standalone pnf mode
UE = PHY_vars_UE_g[ue_Mod_id][0];
-
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
int rx_frame = NFAPI_SFNSF2SF(sfn_sf) < 4 ? (NFAPI_SFNSF2SFN(sfn_sf) + 1023) % 1024 : NFAPI_SFNSF2SFN(sfn_sf); // subtracting 4 from subframe_tx
int rx_subframe = NFAPI_SFNSF2SF(sfn_sf) < 4 ? NFAPI_SFNSF2SF(sfn_sf) + 6 : NFAPI_SFNSF2SF(sfn_sf) - 4;
LOG_D(MAC, "rx_frame %d rx_subframe %d\n", rx_frame, rx_subframe);
+
if (UE->mac_enabled == 1) {
ret = ue_scheduler(ue_Mod_id,
rx_frame,
@@ -1168,67 +1153,60 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
// Prepare the future Tx data
if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) ||
- (UE->frame_parms.frame_type == FDD))
- {
- if (UE->mode != loop_through_memory)
- {
- // We make the start of RA between consecutive UEs differ by 20 frames
- //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
- if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE &&
- is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)))
- {
- UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH;
- }
- LOG_D(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]);
- if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH)
- { //&& ue_Mod_id == next_Mod_id) {
- next_ra_frame++;
- if (next_ra_frame > 500)
- {
- // check if we have PRACH opportunity
- if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1)
- {
- // The one working strangely...
- //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) {
- PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf));
- if (prach_resources != NULL)
- {
- LOG_I(MAC, "preamble_received_tar_power: %d\n",
- prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER);
- UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf);
- LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
- fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
- sent_any = true;
- Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0);
- UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
- next_Mod_id = ue_Mod_id + 1;
- //next_ra_frame = (rx_frame + 20)%1000;
- next_ra_frame = 0;
- }
- //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
- }
- }
- } // mode is PRACH
-
- // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
- // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
- // Generate UL_indications which correspond to UL traffic.
- if (ul_config_req != NULL)
- { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
- ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id);
- }
+ (UE->frame_parms.frame_type == FDD)) {
+ // We make the start of RA between consecutive UEs differ by 20 frames
+ //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
+ if (UE_mac_inst[ue_Mod_id].UE_mode[0] == RA_RESPONSE &&
+ is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf))) {
+ UE_mac_inst[ue_Mod_id].UE_mode[0] = PRACH;
}
- phy_procedures_UE_SL_RX(UE, proc);
- }
- else
- {
+ LOG_D(MAC, "UE_mode: %d\n", UE_mac_inst[ue_Mod_id].UE_mode[0]);
+
+ if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH) {
+ //&& ue_Mod_id == next_Mod_id) {
+ next_ra_frame++;
+
+ if (next_ra_frame > 500) {
+ // check if we have PRACH opportunity
+ if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) {
+ // The one working strangely...
+ //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) {
+ PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf));
+
+ if (prach_resources != NULL) {
+ LOG_I(MAC, "preamble_received_tar_power: %d\n",
+ prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER);
+ UE_mac_inst[ue_Mod_id].ra_frame = NFAPI_SFNSF2SFN(sfn_sf);
+ LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
+ fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
+ sent_any = true;
+ Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0);
+ UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
+ next_Mod_id = ue_Mod_id + 1;
+ //next_ra_frame = (rx_frame + 20)%1000;
+ next_ra_frame = 0;
+ }
+
+ //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
+ }
+ }
+ } // mode is PRACH
+
+ // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
+ // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
+ // Generate UL_indications which correspond to UL traffic.
+ if (ul_config_req != NULL) {
+ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
+ ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id);
+ }
+ } else {
LOG_I(MAC, "Skipping subframe select statement proxy SFN.SF: %d.%d\n",
- NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
- if (ul_config_req != NULL)
- {
+ NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf));
+
+ if (ul_config_req != NULL) {
LOG_I(MAC, "Skipping subframe select statement ul_config_req SFN.SF: %d.%d\n",
- NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf));
+ NFAPI_SFNSF2SFN(ul_config_req->sfn_sf), NFAPI_SFNSF2SF(ul_config_req->sfn_sf));
}
}
} //for (Mod_id=0; Mod_idrx_ind.rx_indication_body.number_of_pdus > 0) {
-
//LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf));
//LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus);
send_standalone_msg(UL_INFO, UL_INFO->rx_ind.header.message_id);
sent_any = true;
-
//LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n");
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
}
@@ -1261,16 +1237,16 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
if (UL_INFO->harq_ind.harq_indication_body.number_of_harqs > 0) {
//LOG_D(MAC, "ul_config_req_UE_MAC 2.4, SFN/SF of PNF counter:%d.%d, number_of_harqs: %d \n", timer_frame, timer_subframe, UL_INFO->harq_ind.harq_indication_body.number_of_harqs);
- send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id);
- sent_any = true;
+ send_standalone_msg(UL_INFO, UL_INFO->harq_ind.header.message_id);
+ sent_any = true;
//LOG_I(MAC, "ul_config_req_UE_MAC 2.41 \n");
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
}
if (UL_INFO->sr_ind.sr_indication_body.number_of_srs > 0) {
//LOG_I(MAC, "ul_config_req_UE_MAC 2.5, SFN/SF of PNF counter:%d.%d, number_of_srs: %d \n", timer_frame, timer_subframe, UL_INFO->sr_ind.sr_indication_body.number_of_srs);
- send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id);
- sent_any = true;
+ send_standalone_msg(UL_INFO, UL_INFO->sr_ind.header.message_id);
+ sent_any = true;
//LOG_I(MAC, "ul_config_req_UE_MAC 2.51 \n");
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
}
@@ -1286,12 +1262,11 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
free(dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list);
dl_config_req_tx_req->dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL;
}
+
nfapi_free_tx_req_pdu_list(dl_config_req_tx_req->tx_req_pdu_list);
dl_config_req_tx_req->tx_req_pdu_list = NULL;
-
free(dl_config_req_tx_req->dl_config_req);
dl_config_req_tx_req->dl_config_req = NULL;
-
free(dl_config_req_tx_req);
dl_config_req_tx_req = NULL;
}
@@ -1315,9 +1290,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
free(hi_dci0_req);
hi_dci0_req = NULL;
}
- if (!sent_any)
- {
- send_standalone_dummy();
+
+ if (!sent_any) {
+ send_standalone_dummy();
}
}
@@ -1336,7 +1311,6 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
free(UL_INFO);
UL_INFO = NULL;
-
// thread finished
free(arg);
return NULL;
@@ -1350,8 +1324,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg)
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
-static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
-{
+static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
#if 0 // TODO: doesn't currently compile, obviated by multi-ue proxy
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
// for multipule UE's L2-emulator
@@ -1377,7 +1350,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0];
phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
UE = rtd->UE;
-
UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t));
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t));
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
@@ -1489,19 +1461,23 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
}
if (dl_config_req && tx_req_pdu_list) {
- nfapi_dl_config_request_body_t* dl_config_req_body = &dl_config_req->dl_config_request_body;
+ nfapi_dl_config_request_body_t *dl_config_req_body = &dl_config_req->dl_config_request_body;
+
for (int i = 0; i < dl_config_req_body->number_pdu; ++i) {
- nfapi_dl_config_request_pdu_t* pdu = &dl_config_req_body->dl_config_pdu_list[i];
+ nfapi_dl_config_request_pdu_t *pdu = &dl_config_req_body->dl_config_pdu_list[i];
+
if (pdu->pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) {
i += 1;
AssertFatal(i < dl_config_req->dl_config_request_body.number_pdu,
"Need PDU following DCI at index %d, but not found\n",
i);
nfapi_dl_config_request_pdu_t *dlsch = &dl_config_req_body->dl_config_pdu_list[i];
+
if (dlsch->pdu_type != NFAPI_DL_CONFIG_DLSCH_PDU_TYPE) {
LOG_E(MAC, "expected DLSCH PDU at index %d\n", i);
continue;
}
+
dl_config_req_UE_MAC_dci(NFAPI_SFNSF2SFN(dl_config_req->sfn_sf),
NFAPI_SFNSF2SF(dl_config_req->sfn_sf),
pdu,
@@ -1523,8 +1499,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
if (hi_dci0_req) {
nfapi_hi_dci0_request_body_t *hi_dci0_body = &hi_dci0_req->hi_dci0_request_body;
+
for (int i = 0; i < hi_dci0_body->number_of_dci + hi_dci0_body->number_of_hi; i++) {
- nfapi_hi_dci0_request_pdu_t* pdu = &hi_dci0_body->hi_dci0_pdu_list[i];
+ nfapi_hi_dci0_request_pdu_t *pdu = &hi_dci0_body->hi_dci0_pdu_list[i];
hi_dci0_req_UE_MAC(NFAPI_SFNSF2SFN(hi_dci0_req->sfn_sf),
NFAPI_SFNSF2SF(hi_dci0_req->sfn_sf),
pdu,
@@ -1592,44 +1569,41 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) )
- if (UE->mode != loop_through_memory) {
- // We make the start of RA between consecutive UEs differ by 20 frames
- //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
- if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) {
- next_ra_frame++;
- if(next_ra_frame > 500) {
- // check if we have PRACH opportunity
- if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) {
- // The one working strangely...
- //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) {
- PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
+ // We make the start of RA between consecutive UEs differ by 20 frames
+ //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) {
+ if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) {
+ next_ra_frame++;
- if(prach_resources!=NULL ) {
- UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx;
- LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id,proc->frame_tx, proc->subframe_tx);
- fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
- Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0);
- UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
- next_Mod_id = ue_Mod_id + 1;
- //next_ra_frame = (proc->frame_rx + 20)%1000;
- next_ra_frame = 0;
- }
+ if(next_ra_frame > 500) {
+ // check if we have PRACH opportunity
+ if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) {
+ // The one working strangely...
+ //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) {
+ PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
- //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
+ if(prach_resources!=NULL ) {
+ UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx;
+ LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id,proc->frame_tx, proc->subframe_tx);
+ fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
+ Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0);
+ UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE;
+ next_Mod_id = ue_Mod_id + 1;
+ //next_ra_frame = (proc->frame_rx + 20)%1000;
+ next_ra_frame = 0;
}
+
+ //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
- } // mode is PRACH
-
- // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
- // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
- // Generate UL_indications which correspond to UL traffic.
- if(ul_config_req!=NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
- ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id);
}
- }
+ } // mode is PRACH
- phy_procedures_UE_SL_RX(UE,proc);
+ // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
+ // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
+ // Generate UL_indications which correspond to UL traffic.
+ if(ul_config_req!=NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){
+ ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id);
+ }
} //for (Mod_id=0; Mod_idnum_single_thread[ue_thread_id] = -1;
@@ -1709,6 +1683,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
tx_req_pdu_list[i].segments[j].segment_data = NULL;
}
}
+
tx_req_num_elems = 0;
free(tx_req_pdu_list);
tx_req_pdu_list = NULL;
@@ -1752,7 +1727,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
free(UL_INFO);
UL_INFO = NULL;
#endif // disabled UE_phy_stub_single_thread_rxn_txnp4
-
// thread finished
free(arg);
return NULL;
@@ -1767,9 +1741,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
-static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
-{
- #if 0
+static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
+#if 0
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
module_id_t Mod_id = 0;
static __thread int UE_thread_rxtx_retval;
@@ -1880,45 +1853,42 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) )
- if (UE->mode != loop_through_memory) {
- if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) {
- // check if we have PRACH opportunity
- if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) {
- PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
+ if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) {
+ // check if we have PRACH opportunity
+ if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) {
+ PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
- if(prach_resources!=NULL) {
- fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
- Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0);
- UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
- }
-
- //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
- }
- } // mode is PRACH
-
- // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
- // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
- // Generate UL_indications which correspond to UL traffic.
- if(ul_config_req!= NULL && ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) {
- //LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n");
- ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id);
-
- if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) {
- free(ul_config_req->ul_config_request_body.ul_config_pdu_list);
- ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL;
+ if(prach_resources!=NULL) {
+ fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
+ Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0);
+ UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
}
- free(ul_config_req);
- ul_config_req = NULL;
- } else if(ul_config_req!=NULL) {
- free(ul_config_req);
- ul_config_req = NULL;
+ //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
+ } // mode is PRACH
+
+ // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
+ // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
+ // Generate UL_indications which correspond to UL traffic.
+ if(ul_config_req!= NULL && ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) {
+ //LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n");
+ ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id);
+
+ if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) {
+ free(ul_config_req->ul_config_request_body.ul_config_pdu_list);
+ ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL;
}
- phy_procedures_UE_SL_RX(UE,proc);
+ free(ul_config_req);
+ ul_config_req = NULL;
+ } else if(ul_config_req!=NULL) {
+ free(ul_config_req);
+ ul_config_req = NULL;
+ }
}
- #endif // disabled
+
+#endif // disabled
// thread finished
free(arg);
return NULL; //return &UE_thread_rxtx_retval;
@@ -1938,22 +1908,21 @@ void write_dummy(PHY_VARS_UE *UE, openair0_timestamp timestamp) {
// we have to write to tell explicitly to the eNB, else it will wait for us forever
// we write the next subframe (always write in future of what we received)
//
- struct complex16 v= {0};
+ c16_t v= {0};
void *samplesVoid[UE->frame_parms.nb_antennas_tx];
-
+
for ( int i=0; i < UE->frame_parms.nb_antennas_tx; i++)
samplesVoid[i]=(void *)&v;
-
+
AssertFatal( 1 == UE->rfdevice.trx_write_func(&UE->rfdevice,
- timestamp+2*UE->frame_parms.samples_per_tti,
- samplesVoid,
- 1,
- UE->frame_parms.nb_antennas_tx,
- 1),"");
+ timestamp+2*UE->frame_parms.samples_per_tti,
+ samplesVoid,
+ 1,
+ UE->frame_parms.nb_antennas_tx,
+ 1),"");
}
-void *UE_thread(void *arg)
-{
+void *UE_thread(void *arg) {
PHY_VARS_UE *UE = (PHY_VARS_UE *) arg;
// int tx_enabled = 0;
int dummy_rx[UE->frame_parms.nb_antennas_rx][UE->frame_parms.samples_per_tti] __attribute__((aligned(32)));
@@ -1966,10 +1935,11 @@ void *UE_thread(void *arg)
int ret;
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
+
if ( threads.main != -1 )
CPU_SET(threads.main, &cpuset);
- init_thread(100000, 500000, FIFO_PRIORITY, &cpuset, "UHD Threads");
+ init_thread(100000, 500000, FIFO_PRIORITY, &cpuset, "UHD Threads");
/*
while (sync_var<0)
pthread_cond_wait(&sync_cond, &sync_mutex);
@@ -1996,46 +1966,45 @@ void *UE_thread(void *arg)
int instance_cnt_synch = UE->proc.instance_cnt_synch;
int is_synchronized = UE->is_synchronized;
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
-
+
if (is_synchronized == 0) {
if (instance_cnt_synch < 0) { // we can invoke the synch
- // we shift in time flow because the UE doesn't detect sync when frame alignment is not easy
- for (int i=0; iframe_parms.nb_antennas_rx; i++)
- rxp[i] = (void *)&dummy_rx[i][0];
- UE->rfdevice.trx_read_func(&UE->rfdevice,
- ×tamp,
- rxp,
- UE->frame_parms.samples_per_tti/2,
- UE->frame_parms.nb_antennas_rx);
-
+ // we shift in time flow because the UE doesn't detect sync when frame alignment is not easy
+ for (int i=0; iframe_parms.nb_antennas_rx; i++)
+ rxp[i] = (void *)&dummy_rx[i][0];
+
+ UE->rfdevice.trx_read_func(&UE->rfdevice,
+ ×tamp,
+ rxp,
+ UE->frame_parms.samples_per_tti/2,
+ UE->frame_parms.nb_antennas_rx);
+
// grab 10 ms of signal and wakeup synch thread
-
- if (UE->mode != loop_through_memory) {
- if (IS_SOFTMODEM_RFSIM ) {
- for(int sf=0; sf<10; sf++) {
- for (int i=0; iframe_parms.nb_antennas_rx; i++)
- rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf];
-
- AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice,
- ×tamp,
- rxp,
- UE->frame_parms.samples_per_tti,
- UE->frame_parms.nb_antennas_rx), "");
- write_dummy(UE, timestamp);
- }
- } else {
- for (int i=0; iframe_parms.nb_antennas_rx; i++)
- rxp[i] = (void *)&UE->common_vars.rxdata[i][0];
-
- AssertFatal( UE->frame_parms.samples_per_tti*10 ==
- UE->rfdevice.trx_read_func(&UE->rfdevice,
- ×tamp,
- rxp,
- UE->frame_parms.samples_per_tti*10,
- UE->frame_parms.nb_antennas_rx), "");
- }
- }
+
+ if (IS_SOFTMODEM_RFSIM ) {
+ for(int sf=0; sf<10; sf++) {
+ for (int i=0; iframe_parms.nb_antennas_rx; i++)
+ rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.samples_per_tti*sf];
+
+ AssertFatal(UE->frame_parms.samples_per_tti == UE->rfdevice.trx_read_func(&UE->rfdevice,
+ ×tamp,
+ rxp,
+ UE->frame_parms.samples_per_tti,
+ UE->frame_parms.nb_antennas_rx), "");
+ write_dummy(UE, timestamp);
+ }
+ } else {
+ for (int i=0; iframe_parms.nb_antennas_rx; i++)
+ rxp[i] = (void *)&UE->common_vars.rxdata[i][0];
+
+ AssertFatal( UE->frame_parms.samples_per_tti*10 ==
+ UE->rfdevice.trx_read_func(&UE->rfdevice,
+ ×tamp,
+ rxp,
+ UE->frame_parms.samples_per_tti*10,
+ UE->frame_parms.nb_antennas_rx), "");
+ }
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
instance_cnt_synch = ++UE->proc.instance_cnt_synch;
@@ -2049,69 +2018,62 @@ void *UE_thread(void *arg)
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
} else {
-#if OAISIM
- (void)dummy_rx; /* avoid gcc warnings */
- usleep(500);
-#else
// grab 10 ms of signal into dummy buffer
- if (UE->mode != loop_through_memory) {
- for (int i=0; iframe_parms.nb_antennas_rx; i++)
- rxp[i] = (void *)&dummy_rx[i][0];
+ for (int i=0; iframe_parms.nb_antennas_rx; i++)
+ rxp[i] = (void *)&dummy_rx[i][0];
- for (int sf=0; sf<10; sf++) {
- // printf("Reading dummy sf %d\n",sf);
- UE->rfdevice.trx_read_func(&UE->rfdevice,
- ×tamp,
- rxp,
- UE->frame_parms.samples_per_tti,
- UE->frame_parms.nb_antennas_rx);
- if (IS_SOFTMODEM_RFSIM )
- write_dummy(UE, timestamp);
- }
- }
-#endif
+ for (int sf=0; sf<10; sf++) {
+ // printf("Reading dummy sf %d\n",sf);
+ UE->rfdevice.trx_read_func(&UE->rfdevice,
+ ×tamp,
+ rxp,
+ UE->frame_parms.samples_per_tti,
+ UE->frame_parms.nb_antennas_rx);
+
+ if (IS_SOFTMODEM_RFSIM )
+ write_dummy(UE, timestamp);
+ }
}
} // UE->is_synchronized==0
else {
if (start_rx_stream==0) {
start_rx_stream=1;
- if (UE->mode != loop_through_memory) {
- if (UE->no_timing_correction==0) {
- LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode);
- while ( UE->rx_offset ) {
- size_t s=min(UE->rx_offset,UE->frame_parms.samples_per_tti);
- AssertFatal(s == UE->rfdevice.trx_read_func(&UE->rfdevice,
- ×tamp,
- (void **)UE->common_vars.rxdata,
- s,
- UE->frame_parms.nb_antennas_rx),"");
- if (IS_SOFTMODEM_RFSIM )
- write_dummy(UE, timestamp);
- UE->rx_offset-=s;
- }
+ if (UE->no_timing_correction==0) {
+ LOG_I(PHY,"Resynchronizing RX by %d samples (mode = %d)\n",UE->rx_offset,UE->mode);
+
+ while ( UE->rx_offset ) {
+ size_t s=min(UE->rx_offset,UE->frame_parms.samples_per_tti);
+ AssertFatal(s == UE->rfdevice.trx_read_func(&UE->rfdevice,
+ ×tamp,
+ (void **)UE->common_vars.rxdata,
+ s,
+ UE->frame_parms.nb_antennas_rx),"");
+
+ if (IS_SOFTMODEM_RFSIM )
+ write_dummy(UE, timestamp);
+
+ UE->rx_offset-=s;
}
+ }
- UE->rx_offset=0;
- UE->time_sync_cell=0;
+ UE->rx_offset=0;
+ UE->time_sync_cell=0;
- //UE->proc.proc_rxtx[0].frame_rx++;
- //UE->proc.proc_rxtx[1].frame_rx++;
- for (th_id=0; th_id < RX_NB_TH; th_id++) {
- UE->proc.proc_rxtx[th_id].frame_rx++;
- }
+ //UE->proc.proc_rxtx[0].frame_rx++;
+ //UE->proc.proc_rxtx[1].frame_rx++;
+ for (th_id=0; th_id < RX_NB_TH; th_id++) {
+ UE->proc.proc_rxtx[th_id].frame_rx++;
+ }
- // read in first symbol
- AssertFatal (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 ==
- UE->rfdevice.trx_read_func(&UE->rfdevice,
- ×tamp,
- (void **)UE->common_vars.rxdata,
- UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0,
- UE->frame_parms.nb_antennas_rx),"");
- slot_fep(UE,0, 0, 0, 0, 0);
- } //UE->mode != loop_through_memory
- else
- rt_sleep_ns(1000*1000);
+ // read in first symbol
+ AssertFatal (UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 ==
+ UE->rfdevice.trx_read_func(&UE->rfdevice,
+ ×tamp,
+ (void **)UE->common_vars.rxdata,
+ UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0,
+ UE->frame_parms.nb_antennas_rx),"");
+ slot_fep(UE,0, 0, 0, 0, 0);
} else {
sub_frame++;
sub_frame%=10;
@@ -2130,7 +2092,8 @@ void *UE_thread(void *arg)
pthread_mutex_unlock(&proc->mutex_rxtx);
}
- usleep(300);
+
+ usleep(300);
}
LOG_D(PHY,"Process Subframe %d thread Idx %d \n", sub_frame, UE->current_thread_id[sub_frame]);
@@ -2139,130 +2102,129 @@ void *UE_thread(void *arg)
if(thread_idx>=RX_NB_TH)
thread_idx = 0;
- if (UE->mode != loop_through_memory) {
- for (i=0; iframe_parms.nb_antennas_rx; i++)
- rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+
- UE->frame_parms.nb_prefix_samples0+
- sub_frame*UE->frame_parms.samples_per_tti];
+ for (i=0; iframe_parms.nb_antennas_rx; i++)
+ rxp[i] = (void *)&UE->common_vars.rxdata[i][UE->frame_parms.ofdm_symbol_size+
+ UE->frame_parms.nb_prefix_samples0+
+ sub_frame*UE->frame_parms.samples_per_tti];
- for (i=0; iframe_parms.nb_antennas_tx; i++)
- txp[i] = (void *)&UE->common_vars.txdata[i][((sub_frame+2)%10)*UE->frame_parms.samples_per_tti];
+ for (i=0; iframe_parms.nb_antennas_tx; i++)
+ txp[i] = (void *)&UE->common_vars.txdata[i][((sub_frame+2)%10)*UE->frame_parms.samples_per_tti];
- int readBlockSize, writeBlockSize;
+ int readBlockSize, writeBlockSize;
- if (sub_frame<9) {
- readBlockSize=UE->frame_parms.samples_per_tti;
- writeBlockSize=UE->frame_parms.samples_per_tti;
- } else {
- // set TO compensation to zero
- UE->rx_offset_diff = 0;
-
- // compute TO compensation that should be applied for this frame
-
- if (UE->no_timing_correction == 0) {
- if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti &&
- UE->rx_offset > 0 )
- UE->rx_offset_diff = -1 ;
-
- if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti &&
- UE->rx_offset < 10*UE->frame_parms.samples_per_tti )
- UE->rx_offset_diff = 1;
- }
-
- LOG_D(PHY,"AbsSubframe %d.%d SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,sub_frame,UE->rx_offset_diff,UE->rx_offset);
- readBlockSize=UE->frame_parms.samples_per_tti -
- UE->frame_parms.ofdm_symbol_size -
- UE->frame_parms.nb_prefix_samples0 -
- UE->rx_offset_diff;
- writeBlockSize=UE->frame_parms.samples_per_tti -
- UE->rx_offset_diff;
- }
-
- AssertFatal(readBlockSize ==
- UE->rfdevice.trx_read_func(&UE->rfdevice,
- ×tamp,
- rxp,
- readBlockSize,
- UE->frame_parms.nb_antennas_rx),"");
- AssertFatal( writeBlockSize ==
- UE->rfdevice.trx_write_func(&UE->rfdevice,
- timestamp+
- (2*UE->frame_parms.samples_per_tti) -
- UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 -
- openair0_cfg[0].tx_sample_advance,
- txp,
- writeBlockSize,
- UE->frame_parms.nb_antennas_tx,
- 1),"");
-
- if( sub_frame==9) {
- // read in first symbol of next frame and adjust for timing drift
- int first_symbols=writeBlockSize-readBlockSize;
-
- if ( first_symbols > 0 )
- AssertFatal(first_symbols ==
- UE->rfdevice.trx_read_func(&UE->rfdevice,
- ×tamp1,
- (void **)UE->common_vars.rxdata,
- first_symbols,
- UE->frame_parms.nb_antennas_rx),"");
-
- if ( first_symbols <0 )
- LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols);
- }
-
- /* no timeout in IS_SOFTMODEM_RFSIM mode */
- if (IS_SOFTMODEM_RFSIM) {
- ret = pthread_mutex_lock(&proc->mutex_rxtx);
- } else {
- struct timespec tv;
- if (clock_gettime(CLOCK_REALTIME, &tv) != 0) {
- perror("clock_gettime");
- exit(1);
- }
- tv.tv_nsec += 10*1000;
- if (tv.tv_nsec >= 1000 * 1000 * 1000) {
- tv.tv_sec++;
- tv.tv_nsec -= 1000 * 1000 * 1000;
- }
- ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv);
- }
-
- // operate on thread sf mod 2
- if (ret != 0) {
- if (ret == ETIMEDOUT) {
- LOG_E(PHY,"Missed real time\n");
- continue;
- } else {
- LOG_E(PHY,"System error %s (%d)\n",strerror(errno),errno);
- abort();
- }
- }
-
- // usleep(3000);
- if(sub_frame == 0) {
- //UE->proc.proc_rxtx[0].frame_rx++;
- //UE->proc.proc_rxtx[1].frame_rx++;
- for (th_id=0; th_id < RX_NB_TH; th_id++) {
- UE->proc.proc_rxtx[th_id].frame_rx++;
- }
- }
-
- proc->subframe_rx=sub_frame;
- proc->subframe_tx=(sub_frame+4)%10;
- proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
- proc->timestamp_tx = timestamp+
- (4*UE->frame_parms.samples_per_tti)-
- UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
- proc->instance_cnt_rxtx++;
- LOG_D( PHY, "[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!\n", UE->Mod_id, proc->instance_cnt_rxtx,proc->subframe_rx);
- T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx));
- AssertFatal (pthread_cond_signal(&proc->cond_rxtx) ==0,"");
- AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,"");
+ if (sub_frame<9) {
+ readBlockSize=UE->frame_parms.samples_per_tti;
+ writeBlockSize=UE->frame_parms.samples_per_tti;
} else {
- printf("Processing subframe %d",proc->subframe_rx);
- getchar();
+ // set TO compensation to zero
+ UE->rx_offset_diff = 0;
+
+ // compute TO compensation that should be applied for this frame
+
+ if (UE->no_timing_correction == 0) {
+ if ( UE->rx_offset < 5*UE->frame_parms.samples_per_tti &&
+ UE->rx_offset > 0 )
+ UE->rx_offset_diff = -1 ;
+
+ if ( UE->rx_offset > 5*UE->frame_parms.samples_per_tti &&
+ UE->rx_offset < 10*UE->frame_parms.samples_per_tti )
+ UE->rx_offset_diff = 1;
+ }
+
+ LOG_D(PHY,"AbsSubframe %d.%d SET rx_off_diff to %d rx_offset %d \n",proc->frame_rx,sub_frame,UE->rx_offset_diff,UE->rx_offset);
+ readBlockSize=UE->frame_parms.samples_per_tti -
+ UE->frame_parms.ofdm_symbol_size -
+ UE->frame_parms.nb_prefix_samples0 -
+ UE->rx_offset_diff;
+ writeBlockSize=UE->frame_parms.samples_per_tti -
+ UE->rx_offset_diff;
}
+
+ AssertFatal(readBlockSize ==
+ UE->rfdevice.trx_read_func(&UE->rfdevice,
+ ×tamp,
+ rxp,
+ readBlockSize,
+ UE->frame_parms.nb_antennas_rx),"");
+ AssertFatal( writeBlockSize ==
+ UE->rfdevice.trx_write_func(&UE->rfdevice,
+ timestamp+
+ (2*UE->frame_parms.samples_per_tti) -
+ UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0 -
+ openair0_cfg[0].tx_sample_advance,
+ txp,
+ writeBlockSize,
+ UE->frame_parms.nb_antennas_tx,
+ 1),"");
+
+ if( sub_frame==9) {
+ // read in first symbol of next frame and adjust for timing drift
+ int first_symbols=writeBlockSize-readBlockSize;
+
+ if ( first_symbols > 0 )
+ AssertFatal(first_symbols ==
+ UE->rfdevice.trx_read_func(&UE->rfdevice,
+ ×tamp1,
+ (void **)UE->common_vars.rxdata,
+ first_symbols,
+ UE->frame_parms.nb_antennas_rx),"");
+
+ if ( first_symbols <0 )
+ LOG_E(PHY,"can't compensate: diff =%d\n", first_symbols);
+ }
+
+ /* no timeout in IS_SOFTMODEM_RFSIM mode */
+ if (IS_SOFTMODEM_RFSIM) {
+ ret = pthread_mutex_lock(&proc->mutex_rxtx);
+ } else {
+ struct timespec tv;
+
+ if (clock_gettime(CLOCK_REALTIME, &tv) != 0) {
+ perror("clock_gettime");
+ exit(1);
+ }
+
+ tv.tv_nsec += 10*1000;
+
+ if (tv.tv_nsec >= 1000 * 1000 * 1000) {
+ tv.tv_sec++;
+ tv.tv_nsec -= 1000 * 1000 * 1000;
+ }
+
+ ret = pthread_mutex_timedlock(&proc->mutex_rxtx, &tv);
+ }
+
+ // operate on thread sf mod 2
+ if (ret != 0) {
+ if (ret == ETIMEDOUT) {
+ LOG_E(PHY,"Missed real time\n");
+ continue;
+ } else {
+ LOG_E(PHY,"System error %s (%d)\n",strerror(errno),errno);
+ abort();
+ }
+ }
+
+ // usleep(3000);
+ if(sub_frame == 0) {
+ //UE->proc.proc_rxtx[0].frame_rx++;
+ //UE->proc.proc_rxtx[1].frame_rx++;
+ for (th_id=0; th_id < RX_NB_TH; th_id++) {
+ UE->proc.proc_rxtx[th_id].frame_rx++;
+ }
+ }
+
+ proc->subframe_rx=sub_frame;
+ proc->subframe_tx=(sub_frame+4)%10;
+ proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
+ proc->timestamp_tx = timestamp+
+ (4*UE->frame_parms.samples_per_tti)-
+ UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
+ proc->instance_cnt_rxtx++;
+ LOG_D( PHY, "[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!\n", UE->Mod_id, proc->instance_cnt_rxtx,proc->subframe_rx);
+ T(T_UE_MASTER_TICK, T_INT(0), T_INT(proc->frame_rx%1024), T_INT(proc->subframe_rx));
+ AssertFatal (pthread_cond_signal(&proc->cond_rxtx) ==0,"");
+ AssertFatal(pthread_mutex_unlock(&proc->mutex_rxtx) ==0,"");
} // start_rx_stream==1
} // UE->is_synchronized==1
} // while !oai_exit
@@ -2283,8 +2245,7 @@ void *UE_thread(void *arg)
* - UE_thread_dlsch_proc_slot1
* and the locking between them.
*/
-void init_UE_threads(int inst)
-{
+void init_UE_threads(int inst) {
struct rx_tx_thread_data *rtd;
PHY_VARS_UE *UE;
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n");
@@ -2339,8 +2300,7 @@ void init_UE_threads(int inst)
* - UE_thread_dlsch_proc_slot1
* and the locking between them.
*/
-void init_UE_single_thread_stub(int nb_inst)
-{
+void init_UE_single_thread_stub(int nb_inst) {
struct rx_tx_thread_data *rtd;
PHY_VARS_UE *UE;
@@ -2368,8 +2328,8 @@ void init_UE_single_thread_stub(int nb_inst)
// In phy_stub_UE mode due to less heavy processing operations we don't need two threads
//int nb_threads=RX_NB_TH;
int nb_threads=1;
+ void *(*task_func)(void *);
- void* (*task_func)(void*);
if (NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) {
task_func = UE_phy_stub_standalone_pnf_task;
} else {
@@ -2413,8 +2373,7 @@ void init_UE_single_thread_stub(int nb_inst)
* - UE_thread_dlsch_proc_slot1
* and the locking between them.
*/
-void init_UE_threads_stub(int inst)
-{
+void init_UE_threads_stub(int inst) {
struct rx_tx_thread_data *rtd;
PHY_VARS_UE *UE;
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n");
@@ -2451,8 +2410,7 @@ void init_UE_threads_stub(int inst)
}
-void fill_ue_band_info(void)
-{
+void fill_ue_band_info(void) {
LTE_UE_EUTRA_Capability_t *UE_EUTRA_Capability = UE_rrc_inst[0].UECap->UE_EUTRA_Capability;
int i,j;
bands_to_scan.nbands = UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count;
@@ -2477,8 +2435,7 @@ void fill_ue_band_info(void)
}
int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
- openair0_config_t *openair0_cfg)
-{
+ openair0_config_t *openair0_cfg) {
int i, CC_id;
LTE_DL_FRAME_PARMS *frame_parms;
@@ -2486,23 +2443,18 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
AssertFatal( phy_vars_ue[CC_id] !=0, "");
frame_parms = &(phy_vars_ue[CC_id]->frame_parms);
// replace RX signal buffers with mmaped HW versions
- rxdata = (int32_t **)malloc16( frame_parms->nb_antennas_rx*sizeof(int32_t *) );
- txdata = (int32_t **)malloc16( frame_parms->nb_antennas_tx*sizeof(int32_t *) );
-
for (i=0; inb_antennas_rx; i++) {
LOG_I(PHY, "Mapping UE CC_id %d, rx_ant %d, freq %lu on card %d, chain %d\n",
CC_id, i, downlink_frequency[CC_id][i], phy_vars_ue[CC_id]->rf_map.card, (phy_vars_ue[CC_id]->rf_map.chain)+i );
free( phy_vars_ue[CC_id]->common_vars.rxdata[i] );
- rxdata[i] = (int32_t *)malloc16_clear( 307200*sizeof(int32_t) );
- phy_vars_ue[CC_id]->common_vars.rxdata[i] = rxdata[i]; // what about the "-N_TA_offset" ? // N_TA offset for TDD
+ phy_vars_ue[CC_id]->common_vars.rxdata[i] = malloc16_clear( 307200*sizeof(int32_t) ); // what about the "-N_TA_offset" ? // N_TA offset for TDD
}
for (i=0; inb_antennas_tx; i++) {
LOG_I(PHY, "Mapping UE CC_id %d, tx_ant %d, freq %lu on card %d, chain %d\n",
CC_id, i, downlink_frequency[CC_id][i], phy_vars_ue[CC_id]->rf_map.card, (phy_vars_ue[CC_id]->rf_map.chain)+i );
free( phy_vars_ue[CC_id]->common_vars.txdata[i] );
- txdata[i] = (int32_t *)malloc16_clear( 307200*sizeof(int32_t) );
- phy_vars_ue[CC_id]->common_vars.txdata[i] = txdata[i];
+ phy_vars_ue[CC_id]->common_vars.txdata[i] = malloc16_clear( 307200*sizeof(int32_t) );
}
// rxdata[x] points now to the same memory region as phy_vars_ue[CC_id]->common_vars.rxdata[x]
@@ -2520,8 +2472,7 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue,
// playing the role of nfapi-pnf.
//02/02/2018
-static void *timer_thread( void *param )
-{
+static void *timer_thread( void *param ) {
thread_top_init("timer_thread",1,870000L,1000000L,1000000L);
timer_subframe =9;
timer_frame =1023;
@@ -2647,8 +2598,7 @@ static void *timer_thread( void *param )
}
-int init_timer_thread(void)
-{
+int init_timer_thread(void) {
//PHY_VARS_UE *UE=PHY_vars_UE_g[0];
PHY_VARS_UE *UE=PHY_vars_UE_g[0][0];
phy_stub_ticking = (SF_ticking *)malloc(sizeof(SF_ticking));
@@ -2670,8 +2620,7 @@ int init_timer_thread(void)
*/
int8_t find_dlsch(uint16_t rnti,
PHY_VARS_eNB *eNB,
- find_type_t type)
-{
+ find_type_t type) {
printf("you cannot read this\n");
abort();
}
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index 8cdef647ca..089941c7df 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -276,7 +276,6 @@ uint16_t node_number;
static void get_options(void) {
int CC_id=0;
int tddflag=0;
- char *loopfile=NULL;
int dumpframe=0;
int timingadv=0;
uint8_t nfapi_mode = NFAPI_MONOLITHIC;
@@ -293,14 +292,6 @@ static void get_options(void) {
config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
nfapi_setmode(nfapi_mode);
-
- if (loopfile != NULL) {
- printf("Input file for hardware emulation: %s",loopfile);
- mode=loop_through_memory;
- input_fd = fopen(loopfile,"r");
- AssertFatal(input_fd != NULL,"Please provide a valid input file\n");
- }
-
get_softmodem_params()->hw_timing_advance = timingadv;
if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue;