Commit 1b1a2c84 authored by matzakos's avatar matzakos

Merge with develop, resolve conflicts in CU/DU conf files

parents f1e43eb7 de553cd1
...@@ -596,20 +596,6 @@ class Containerize(): ...@@ -596,20 +596,6 @@ class Containerize():
else: else:
time.sleep(10) time.sleep(10)
# HACK TO REMOVE LATER WHEN FIX
res = re.search('oai-nr-ue', self.services[0])
if res is not None:
cmd = 'docker exec rfsim5g-oai-nr-ue /bin/bash -c "ip route del default"'
logging.debug(cmd)
deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
cmd = 'docker exec rfsim5g-oai-nr-ue /bin/bash -c "ip route del 12.1.1.0/24"'
logging.debug(cmd)
deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
cmd = 'docker exec rfsim5g-oai-nr-ue /bin/bash -c "ip route add default via 12.1.1.2 dev oaitun_ue1"'
logging.debug(cmd)
deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
# END OF HACK TO REMOVE LATER WHEN FIX
if count == 100 and healthy == self.nb_healthy[0]: if count == 100 and healthy == self.nb_healthy[0]:
HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK)
logging.info('\u001B[1m Deploying OAI Object(s) PASS\u001B[0m') logging.info('\u001B[1m Deploying OAI Object(s) PASS\u001B[0m')
...@@ -628,7 +614,7 @@ class Containerize(): ...@@ -628,7 +614,7 @@ class Containerize():
logging.debug(cmd) logging.debug(cmd)
subprocess.run(cmd, shell=True) subprocess.run(cmd, shell=True)
# if the containers are running, recover the logs! # if the containers are running, recover the logs!
cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml ps --all' cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml ps --all'
logging.debug(cmd) logging.debug(cmd)
deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10)
...@@ -831,7 +817,9 @@ class Containerize(): ...@@ -831,7 +817,9 @@ class Containerize():
logging.debug('\u001B[1;34m Jitter : ' + jitter + '\u001B[0m') logging.debug('\u001B[1;34m Jitter : ' + jitter + '\u001B[0m')
self.IperfExit(HTML, iperfStatus, msg) self.IperfExit(HTML, iperfStatus, msg)
else: else:
iperfStatus = False
logging.error('problem?') logging.error('problem?')
self.IperfExit(HTML, iperfStatus, 'problem?')
if iperfStatus: if iperfStatus:
logging.info('\u001B[1m Iperf Test PASS\u001B[0m') logging.info('\u001B[1m Iperf Test PASS\u001B[0m')
......
...@@ -2005,6 +2005,7 @@ class OaiCiTest(): ...@@ -2005,6 +2005,7 @@ class OaiCiTest():
curr_br = curr_br * 1000 * 1000 curr_br = curr_br * 1000 * 1000
br_sum = curr_br + br_sum br_sum = curr_br + br_sum
ji_sum = float(ji[0]) + ji_sum ji_sum = float(ji[0]) + ji_sum
if (row_idx > 0): if (row_idx > 0):
br_sum = br_sum / row_idx br_sum = br_sum / row_idx
ji_sum = ji_sum / row_idx ji_sum = ji_sum / row_idx
...@@ -2025,10 +2026,12 @@ class OaiCiTest(): ...@@ -2025,10 +2026,12 @@ class OaiCiTest():
pl = float(100 * pl_sum / ps_sum) pl = float(100 * pl_sum / ps_sum)
packetloss = '%2.1f ' % (pl) packetloss = '%2.1f ' % (pl)
packetloss += '%' packetloss += '%'
else: if float(pl) > float(self.iperf_packetloss_threshold):
packetloss = 'unknown' pal_too_high_msg = 'Packet Loss too high : actual = '+packetloss+', target = '+self.iperf_packetloss_threshold+'%\n'
else:
pal_too_high_msg=''
lock.acquire() lock.acquire()
if (br_loss < 90): if (br_loss < 90) or (float(pl) > float(self.iperf_packetloss_threshold)):
statusQueue.put(1) statusQueue.put(1)
else: else:
statusQueue.put(0) statusQueue.put(0)
...@@ -2039,13 +2042,14 @@ class OaiCiTest(): ...@@ -2039,13 +2042,14 @@ class OaiCiTest():
brl_msg = 'Bitrate Perf: ' + bitperf brl_msg = 'Bitrate Perf: ' + bitperf
jit_msg = 'Jitter : ' + jitter jit_msg = 'Jitter : ' + jitter
pal_msg = 'Packet Loss : ' + packetloss pal_msg = 'Packet Loss : ' + packetloss
statusQueue.put(req_msg + '\n' + bir_msg + '\n' + brl_msg + '\n' + jit_msg + '\n' + pal_msg + '\n') statusQueue.put(req_msg + '\n' + bir_msg + '\n' + brl_msg + '\n' + jit_msg + '\n' + pal_msg + '\n' + pal_too_high_msg + '\n')
logging.debug('\u001B[1;37;45m iperf result (' + UE_IPAddress + ') \u001B[0m') logging.debug('\u001B[1;37;45m iperf result (' + UE_IPAddress + ') \u001B[0m')
logging.debug('\u001B[1;35m ' + req_msg + '\u001B[0m') logging.debug('\u001B[1;35m ' + req_msg + '\u001B[0m')
logging.debug('\u001B[1;35m ' + bir_msg + '\u001B[0m') logging.debug('\u001B[1;35m ' + bir_msg + '\u001B[0m')
logging.debug('\u001B[1;35m ' + brl_msg + '\u001B[0m') logging.debug('\u001B[1;35m ' + brl_msg + '\u001B[0m')
logging.debug('\u001B[1;35m ' + jit_msg + '\u001B[0m') logging.debug('\u001B[1;35m ' + jit_msg + '\u001B[0m')
logging.debug('\u001B[1;35m ' + pal_msg + '\u001B[0m') logging.debug('\u001B[1;35m ' + pal_msg + '\u001B[0m')
logging.debug('\u001B[1;35m ' + pal_too_high_msg + '\u001B[0m')
lock.release() lock.release()
else: else:
self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Could not analyze from server log') self.ping_iperf_wrong_exit(lock, UE_IPAddress, device_id, statusQueue, 'Could not analyze from server log')
...@@ -2705,7 +2709,7 @@ class OaiCiTest(): ...@@ -2705,7 +2709,7 @@ class OaiCiTest():
if (status_queue.empty()): if (status_queue.empty()):
HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.ALL_PROCESSES_OK) HTML.CreateHtmlTestRow(self.iperf_args, 'KO', CONST.ALL_PROCESSES_OK)
self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC,InfaUE) self.AutoTerminateUEandeNB(HTML,RAN,COTS_UE,EPC,InfraUE)
else: else:
iperf_status = True iperf_status = True
iperf_noperf = False iperf_noperf = False
......
<!--
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The OpenAirInterface Software Alliance licenses this file to You under
the OAI Public License, Version 1.1 (the "License"); you may not use this file
except in compliance with the License.
You may obtain a copy of the License at
http://www.openairinterface.org/?page_id=698
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For more information about the OpenAirInterface (OAI) Software Alliance:
contact@openairinterface.org
-->
<testCaseList>
<htmlTabRef>rfsim-4glte</htmlTabRef>
<htmlTabName>Testing 4G LTE RF sim in containers</htmlTabName>
<htmlTabIcon>wrench</htmlTabIcon>
<TestCaseRequestedList>
100011
000011
000001
000012
000002
000013
000001
000014
000002
020011
020012
030011
030012
100011
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="000011">
<class>DeployGenObject</class>
<desc>Deploy Cassandra Database</desc>
<yaml_path>yaml_files/4g_rfsimulator</yaml_path>
<services>cassandra db_init</services>
<nb_healthy>1</nb_healthy>
</testCase>
<testCase id="000001">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>30</idle_sleep_time_in_sec>
</testCase>
<testCase id="000002">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>10</idle_sleep_time_in_sec>
</testCase>
<testCase id="000012">
<class>DeployGenObject</class>
<desc>Deploy OAI 4G CoreNetwork</desc>
<yaml_path>yaml_files/4g_rfsimulator</yaml_path>
<services>oai_hss oai_mme oai_spgwc oai_spgwu trf_gen</services>
<nb_healthy>6</nb_healthy>
</testCase>
<testCase id="000013">
<class>DeployGenObject</class>
<desc>Deploy OAI 4G eNB RF sim</desc>
<yaml_path>yaml_files/4g_rfsimulator</yaml_path>
<services>enb</services>
<nb_healthy>7</nb_healthy>
</testCase>
<testCase id="000014">
<class>DeployGenObject</class>
<desc>Deploy OAI 4G NR-UE RF sim</desc>
<yaml_path>yaml_files/4g_rfsimulator</yaml_path>
<services>oai_ue0</services>
<nb_healthy>8</nb_healthy>
</testCase>
<testCase id="020011">
<class>PingFromContainer</class>
<desc>Ping Traffic-Gen from LTE-UE</desc>
<container_name>rfsim4g-oai-lte-ue0</container_name>
<options>-I oaitun_ue1 -c 20 192.168.61.11</options>
<loss_threshold>5</loss_threshold>
</testCase>
<testCase id="020012">
<class>PingFromContainer</class>
<desc>Ping LTE-UE from Traffic-Gen</desc>
<container_name>rfsim4g-trf-gen</container_name>
<options>-c 20 12.0.0.2</options>
<loss_threshold>5</loss_threshold>
</testCase>
<testCase id="030011">
<class>IperfFromContainer</class>
<desc>Iperf UDP Downlink</desc>
<server_container_name>rfsim4g-oai-lte-ue0</server_container_name>
<client_container_name>rfsim4g-trf-gen</client_container_name>
<server_options>-B 12.0.0.2 -u -i 1 -s</server_options>
<client_options>-c 12.0.0.2 -u -i 1 -t 30 -b 2M</client_options>
</testCase>
<testCase id="030012">
<class>IperfFromContainer</class>
<desc>Iperf UDP Uplink</desc>
<server_container_name>rfsim4g-trf-gen</server_container_name>
<client_container_name>rfsim4g-oai-lte-ue0</client_container_name>
<server_options>-u -i 1 -s</server_options>
<client_options>-B 12.0.0.2 -c 192.168.61.11 -u -i 1 -t 30 -b 1M</client_options>
</testCase>
<testCase id="100011">
<class>UndeployGenObject</class>
<desc>Undeploy all OAI 4G stack</desc>
<yaml_path>yaml_files/4g_rfsimulator</yaml_path>
</testCase>
</testCaseList>
<!--
Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The OpenAirInterface Software Alliance licenses this file to You under
the OAI Public License, Version 1.1 (the "License"); you may not use this file
except in compliance with the License.
You may obtain a copy of the License at
http://www.openairinterface.org/?page_id=698
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For more information about the OpenAirInterface (OAI) Software Alliance:
contact@openairinterface.org
-->
<testCaseList>
<htmlTabRef>rfsim-4glte-down</htmlTabRef>
<htmlTabName>CleanUp 4G RF</htmlTabName>
<htmlTabIcon>trash</htmlTabIcon>
<TestCaseRequestedList>
100011
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="100011">
<class>UndeployGenObject</class>
<desc>Undeploy all OAI 4G stack</desc>
<yaml_path>yaml_files/4g_rfsimulator</yaml_path>
</testCase>
</testCaseList>
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<htmlTabName>Testing 5G NR RF sim in containers</htmlTabName> <htmlTabName>Testing 5G NR RF sim in containers</htmlTabName>
<htmlTabIcon>wrench</htmlTabIcon> <htmlTabIcon>wrench</htmlTabIcon>
<TestCaseRequestedList> <TestCaseRequestedList>
100001
000001 000001
000002 000002
000003 000003
......
...@@ -218,34 +218,6 @@ oaitun_ue1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500 ...@@ -218,34 +218,6 @@ oaitun_ue1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
``` ```
**CAUTION: THESE NEXT FEW COMMANDS ARE A HACK. RAN developers SHALL FIX THIS!**
```bash
$ docker exec -it rfsim5g-oai-nr-ue /bin/bash
# Check the current routes
root@bb4d400a832d:/opt/oai-nr-ue# ip route
default via 192.168.71.129 dev eth0
12.1.1.0/24 dev oaitun_ue1 proto kernel scope link src 12.1.1.2
192.168.71.128/26 dev eth0 proto kernel scope link src 192.168.71.137
# Remove the default and PDN routes
root@bb4d400a832d:/opt/oai-nr-ue# ip route del default
root@bb4d400a832d:/opt/oai-nr-ue# ip route del 12.1.1.0/24
# Force the default route through oaitun_ue1 tunnel
root@bb4d400a832d:/opt/oai-nr-ue# ip route add default via 12.1.1.2 dev oaitun_ue1
# Check the new routes
root@bb4d400a832d:/opt/oai-nr-ue# ip route
default via 12.1.1.2 dev oaitun_ue1
192.168.71.128/26 dev eth0 proto kernel scope link src 192.168.71.137
```
# 3. Check traffic # # 3. Check traffic #
## 3.1. Check your Internet connectivity ## ## 3.1. Check your Internet connectivity ##
......
...@@ -16,7 +16,7 @@ ID = ENB_PHY_DL_TICK ...@@ -16,7 +16,7 @@ ID = ENB_PHY_DL_TICK
ID = ENB_PHY_DLSCH_UE_DCI ID = ENB_PHY_DLSCH_UE_DCI
DESC = eNodeB downlink UE specific DCI as sent by the PHY layer DESC = eNodeB downlink UE specific DCI as sent by the PHY layer
GROUP = ALL:PHY:GRAPHIC:ENB GROUP = ALL:PHY:GRAPHIC:ENB
FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS FORMAT = int,eNB_ID : int,frame : int,subframe : int,rnti : int,dci_format : int,harq_pid : int,mcs : int,TBS : int,ndi : int,rv : int,rbc : int,nb_rb : int,rb_alloc
ID = ENB_PHY_DLSCH_UE_ACK ID = ENB_PHY_DLSCH_UE_ACK
DESC = eNodeB downlink UE ACK as seen by the PHY layer in process_HARQ_feedback DESC = eNodeB downlink UE ACK as seen by the PHY layer in process_HARQ_feedback
GROUP = ALL:PHY:GRAPHIC:ENB GROUP = ALL:PHY:GRAPHIC:ENB
......
...@@ -106,6 +106,40 @@ nr_bandentry_t nr_bandtable[] = { ...@@ -106,6 +106,40 @@ nr_bandentry_t nr_bandtable[] = {
{261,27500040,28350000,27500040,28350000, 2,2070833, 120} {261,27500040,28350000,27500040,28350000, 2,2070833, 120}
}; };
uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex)
{
const uint64_t dl_freq_khz = downlink_frequency / 1000;
const int32_t delta_duplex_khz = delta_duplex / 1000;
uint64_t center_freq_diff_khz = 999999999999999999; // 2^64
uint16_t current_band = 0;
for (int ind = 0; ind < nr_bandtable_size; ind++) {
if (dl_freq_khz < nr_bandtable[ind].dl_min || dl_freq_khz > nr_bandtable[ind].dl_max)
continue;
int32_t current_offset_khz = nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min;
if (current_offset_khz != delta_duplex_khz)
continue;
uint64_t center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min) / 2;
if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){
current_band = nr_bandtable[ind].band;
center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz);
}
}
printf("DL frequency %"PRIu64": band %d, UL frequency %"PRIu64"\n",
downlink_frequency, current_band, downlink_frequency+delta_duplex);
AssertFatal(current_band != 0, "Can't find EUTRA band for frequency %"PRIu64" and duplex_spacing %u\n", downlink_frequency, delta_duplex);
return current_band;
}
const size_t nr_bandtable_size = sizeof(nr_bandtable) / sizeof(nr_bandentry_t); const size_t nr_bandtable_size = sizeof(nr_bandtable) / sizeof(nr_bandentry_t);
int NRRIV2BW(int locationAndBandwidth,int N_RB) { int NRRIV2BW(int locationAndBandwidth,int N_RB) {
......
...@@ -50,6 +50,7 @@ typedef struct nr_bandentry_s { ...@@ -50,6 +50,7 @@ typedef struct nr_bandentry_s {
extern const size_t nr_bandtable_size; extern const size_t nr_bandtable_size;
extern nr_bandentry_t nr_bandtable[]; extern nr_bandentry_t nr_bandtable[];
uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex);
int NRRIV2BW(int locationAndBandwidth,int N_RB); int NRRIV2BW(int locationAndBandwidth,int N_RB);
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB); int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize); int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize);
......
...@@ -209,6 +209,10 @@ int background_system(char *command) { ...@@ -209,6 +209,10 @@ int background_system(char *command) {
void start_background_system(void) { void start_background_system(void) {
int p[2]; int p[2];
pid_t son; pid_t son;
if (module_initialized == 1)
return;
module_initialized = 1; module_initialized = 1;
if (pipe(p) == -1) { if (pipe(p) == -1) {
......
...@@ -37,9 +37,7 @@ RUN /bin/sh oaienv && \ ...@@ -37,9 +37,7 @@ RUN /bin/sh oaienv && \
mkdir -p log && \ mkdir -p log && \
./build_oai --UE --ninja -w USRP --verbose-ci ./build_oai --UE --ninja -w USRP --verbose-ci
RUN yum install -y python3-pip && \ RUN python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \
pip3 install --ignore-installed pyyaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml
#start from scratch for target executable #start from scratch for target executable
......
...@@ -37,9 +37,7 @@ RUN /bin/sh oaienv && \ ...@@ -37,9 +37,7 @@ RUN /bin/sh oaienv && \
mkdir -p log && \ mkdir -p log && \
./build_oai --UE --ninja -w USRP --verbose-ci ./build_oai --UE --ninja -w USRP --verbose-ci
RUN apt-get install -y python3-pip && \ RUN python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \
pip3 install --ignore-installed pyyaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml
#start from scratch for target executable #start from scratch for target executable
......
...@@ -49,6 +49,7 @@ RUN yum update -y && \ ...@@ -49,6 +49,7 @@ RUN yum update -y && \
nettle \ nettle \
net-tools \ net-tools \
iputils \ iputils \
iproute \
atlas \ atlas \
libXpm \ libXpm \
libX11 \ libX11 \
......
...@@ -6,6 +6,7 @@ PREFIX=/opt/oai-enb ...@@ -6,6 +6,7 @@ PREFIX=/opt/oai-enb
RRC_INACTIVITY_THRESHOLD=${RRC_INACTIVITY_THRESHOLD:-0} RRC_INACTIVITY_THRESHOLD=${RRC_INACTIVITY_THRESHOLD:-0}
ENABLE_MEASUREMENT_REPORTS=${ENABLE_MEASUREMENT_REPORTS:-no} ENABLE_MEASUREMENT_REPORTS=${ENABLE_MEASUREMENT_REPORTS:-no}
ENABLE_X2=${ENABLE_X2:-no} ENABLE_X2=${ENABLE_X2:-no}
THREAD_PARALLEL_CONFIG=${THREAD_PARALLEL_CONFIG:-PARALLEL_SINGLE_THREAD}
# Based another env var, pick one template to use # Based another env var, pick one template to use
if [[ -v USE_FDD_CU ]]; then ln -s $PREFIX/etc/cu.fdd.conf $PREFIX/etc/enb.conf; fi if [[ -v USE_FDD_CU ]]; then ln -s $PREFIX/etc/cu.fdd.conf $PREFIX/etc/enb.conf; fi
......
...@@ -98,6 +98,8 @@ ...@@ -98,6 +98,8 @@
env: "@NID_CELL@" env: "@NID_CELL@"
- key: N_RB_DL - key: N_RB_DL
env: "@NB_PRB@" env: "@NB_PRB@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: rru.fdd - filePrefix: rru.fdd
outputfilename: "rru.fdd.conf" outputfilename: "rru.fdd.conf"
...@@ -110,6 +112,8 @@ ...@@ -110,6 +112,8 @@
env: "@RRU_LOCAL_IP_ADDRESS@" env: "@RRU_LOCAL_IP_ADDRESS@"
- key: bands - key: bands
env: "@UTRA_BAND_ID@" env: "@UTRA_BAND_ID@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: rru.tdd - filePrefix: rru.tdd
outputfilename: "rru.tdd.conf" outputfilename: "rru.tdd.conf"
...@@ -122,6 +126,8 @@ ...@@ -122,6 +126,8 @@
env: "@RRU_LOCAL_IP_ADDRESS@" env: "@RRU_LOCAL_IP_ADDRESS@"
- key: bands - key: bands
env: "@UTRA_BAND_ID@" env: "@UTRA_BAND_ID@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: enb.band7.tm1.fr1.25PRB.usrpb210.conf - filePrefix: enb.band7.tm1.fr1.25PRB.usrpb210.conf
outputfilename: "enb.fdd.conf" outputfilename: "enb.fdd.conf"
...@@ -171,6 +177,8 @@ ...@@ -171,6 +177,8 @@
env: "@FLEXRAN_INTERFACE_NAME@" env: "@FLEXRAN_INTERFACE_NAME@"
- key: FLEXRAN_IPV4_ADDRESS - key: FLEXRAN_IPV4_ADDRESS
env: "@FLEXRAN_IPV4_ADDRESS@" env: "@FLEXRAN_IPV4_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: enb.band40.tm1.25PRB.FairScheduler.usrpb210 - filePrefix: enb.band40.tm1.25PRB.FairScheduler.usrpb210
outputfilename: "enb.tdd.conf" outputfilename: "enb.tdd.conf"
...@@ -208,6 +216,8 @@ ...@@ -208,6 +216,8 @@
env: "@F1_CU_IP_ADDRESS@" env: "@F1_CU_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C - key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@" env: "@F1_CU_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: "rcc.band7.tm1.nfapi" - filePrefix: "rcc.band7.tm1.nfapi"
outputfilename: "rcc.nfapi.fdd.conf" outputfilename: "rcc.nfapi.fdd.conf"
...@@ -251,6 +261,8 @@ ...@@ -251,6 +261,8 @@
env: "@F1_CU_IP_ADDRESS@" env: "@F1_CU_IP_ADDRESS@"
- key: ENB_IPV4_ADDRESS_FOR_X2C - key: ENB_IPV4_ADDRESS_FOR_X2C
env: "@F1_CU_IP_ADDRESS@" env: "@F1_CU_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: "rcc.band7.tm1.if4p5.lo.25PRB" - filePrefix: "rcc.band7.tm1.if4p5.lo.25PRB"
outputfilename: "rcc.if4p5.fdd.conf" outputfilename: "rcc.if4p5.fdd.conf"
...@@ -294,6 +306,8 @@ ...@@ -294,6 +306,8 @@
env: "@IF4P5_RRU_IP_ADDRESS@" env: "@IF4P5_RRU_IP_ADDRESS@"
- key: local_address - key: local_address
env: "@IF4P5_RCC_IP_ADDRESS@" env: "@IF4P5_RCC_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: "rcc.band40.tm1.25PRB" - filePrefix: "rcc.band40.tm1.25PRB"
outputfilename: "rcc.if4p5.tdd.conf" outputfilename: "rcc.if4p5.tdd.conf"
...@@ -337,4 +351,6 @@ ...@@ -337,4 +351,6 @@
env: "@IF4P5_RRU_IP_ADDRESS@" env: "@IF4P5_RRU_IP_ADDRESS@"
- key: local_address - key: local_address
env: "@IF4P5_RCC_IP_ADDRESS@" env: "@IF4P5_RCC_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
...@@ -4,6 +4,7 @@ set -euo pipefail ...@@ -4,6 +4,7 @@ set -euo pipefail
PREFIX=/opt/oai-gnb PREFIX=/opt/oai-gnb
ENABLE_X2=${ENABLE_X2:-yes} ENABLE_X2=${ENABLE_X2:-yes}
THREAD_PARALLEL_CONFIG=${THREAD_PARALLEL_CONFIG:-PARALLEL_SINGLE_THREAD}
# Based another env var, pick one template to use # Based another env var, pick one template to use
if [[ -v USE_NSA_TDD_MONO ]]; then ln -s $PREFIX/etc/gnb.nsa.tdd.conf $PREFIX/etc/gnb.conf; fi if [[ -v USE_NSA_TDD_MONO ]]; then ln -s $PREFIX/etc/gnb.nsa.tdd.conf $PREFIX/etc/gnb.conf; fi
......
...@@ -61,6 +61,8 @@ ...@@ -61,6 +61,8 @@
env: "@FLEXRAN_INTERFACE_NAME@" env: "@FLEXRAN_INTERFACE_NAME@"
- key: FLEXRAN_IPV4_ADDRESS - key: FLEXRAN_IPV4_ADDRESS
env: "@FLEXRAN_IPV4_ADDRESS@" env: "@FLEXRAN_IPV4_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
- filePrefix: gnb.band78.sa.fr1.106PRB.usrpn310.conf - filePrefix: gnb.band78.sa.fr1.106PRB.usrpn310.conf
outputfilename: "gnb.sa.tdd.conf" outputfilename: "gnb.sa.tdd.conf"
...@@ -89,4 +91,6 @@ ...@@ -89,4 +91,6 @@
env: "@GNB_NGU_IF_NAME@" env: "@GNB_NGU_IF_NAME@"
- key: GNB_IPV4_ADDRESS_FOR_NGU - key: GNB_IPV4_ADDRESS_FOR_NGU
env: "@GNB_NGU_IP_ADDRESS@" env: "@GNB_NGU_IP_ADDRESS@"
- key: parallel_config
env: "@THREAD_PARALLEL_CONFIG@"
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n" #define CONFIG_HLP_NOSNGLT "Disables single-thread mode in lte-softmodem\n"
#define CONFIG_HLP_TADV "Set timing_advance\n" #define CONFIG_HLP_TADV "Set timing_advance\n"
#define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n" #define CONFIG_HLP_DLF "Set the downlink frequency for all component carriers\n"
#define CONFIG_HLP_ULOFF "Set the uplink frequnecy offset for all component carriers\n"
#define CONFIG_HLP_CHOFF "Channel id offset\n" #define CONFIG_HLP_CHOFF "Channel id offset\n"
#define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n" #define CONFIG_HLP_SOFTS "Enable soft scope and L1 and L2 stats (Xforms)\n"
#define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n" #define CONFIG_HLP_EXMCAL "Calibrate the EXMIMO borad, available files: exmimo2_2arxg.lime exmimo2_2brxg.lime \n"
...@@ -71,13 +72,14 @@ ...@@ -71,13 +72,14 @@
#define CONFIG_HLP_DLMCS_PHYTEST "Set the downlink MCS for PHYTEST mode\n" #define CONFIG_HLP_DLMCS_PHYTEST "Set the downlink MCS for PHYTEST mode\n"
#define CONFIG_HLP_DLNL_PHYTEST "Set the downlink nrOfLayers for PHYTEST mode\n" #define CONFIG_HLP_DLNL_PHYTEST "Set the downlink nrOfLayers for PHYTEST mode\n"
#define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n" #define CONFIG_HLP_STMON "Enable processing timing measurement of lte softmodem on per subframe basis \n"
#define CONFIG_HLP_PRB "Set the PRB, valid values: 6, 25, 50, 100 \n"
#define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n" #define CONFIG_HLP_MSLOTS "Skip the missed slots/subframes \n"
#define CONFIG_HLP_ULMCS_PHYTEST "Set the uplink MCS for PHYTEST mode\n" #define CONFIG_HLP_ULMCS_PHYTEST "Set the uplink MCS for PHYTEST mode\n"
#define CONFIG_HLP_DLBW_PHYTEST "Set the number of PRBs used for DLSCH in PHYTEST mode\n" #define CONFIG_HLP_DLBW_PHYTEST "Set the number of PRBs used for DLSCH in PHYTEST mode\n"
#define CONFIG_HLP_ULBW_PHYTEST "Set the number of PRBs used for ULSCH in PHYTEST mode\n" #define CONFIG_HLP_ULBW_PHYTEST "Set the number of PRBs used for ULSCH in PHYTEST mode\n"
#define CONFIG_HLP_PRB_SA "Set the number of PRBs for SA\n"
#define CONFIG_HLP_DLBM_PHYTEST "Bitmap for DLSCH slots (slot 0 starts at LSB)\n" #define CONFIG_HLP_DLBM_PHYTEST "Bitmap for DLSCH slots (slot 0 starts at LSB)\n"
#define CONFIG_HLP_ULBM_PHYTEST "Bitmap for ULSCH slots (slot 0 starts at LSB)\n" #define CONFIG_HLP_ULBM_PHYTEST "Bitmap for ULSCH slots (slot 0 starts at LSB)\n"
#define CONFIG_HLP_SSC "Set the start subcarrier \n"
#define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n" #define CONFIG_HLP_TDD "Set hardware to TDD mode (default: FDD). Used only with -U (otherwise set in config file).\n"
#define CONFIG_HLP_UE "Set the lte softmodem as a UE\n" #define CONFIG_HLP_UE "Set the lte softmodem as a UE\n"
#define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n" #define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n"
...@@ -119,7 +121,7 @@ ...@@ -119,7 +121,7 @@
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
{"G" , CONFIG_HLP_LOGV, 0, uptr:&glog_verbosity, defintval:0, TYPE_UINT16, 0}, \ {"G" , CONFIG_HLP_LOGV, 0, uptr:&glog_verbosity, defintval:0, TYPE_UINT16, 0}, \
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \ {"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:&START_MSC, defintval:0, TYPE_UINT, 0}, \
} }
#define CMDLINE_ONLINELOG_IDX 0 #define CMDLINE_ONLINELOG_IDX 0
......
...@@ -823,7 +823,8 @@ int main( int argc, char **argv ) { ...@@ -823,7 +823,8 @@ int main( int argc, char **argv ) {
} }
printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
end_configmodule(); // We have to set PARAMFLAG_NOFREE on right paramters before re-enabling end_configmodule()
//end_configmodule();
printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
// wait for end of program // wait for end of program
printf("TYPE <CTRL-C> TO TERMINATE\n"); printf("TYPE <CTRL-C> TO TERMINATE\n");
......
...@@ -222,7 +222,7 @@ static void UE_synch(void *arg) { ...@@ -222,7 +222,7 @@ static void UE_synch(void *arg) {
uint64_t dl_carrier, ul_carrier; uint64_t dl_carrier, ul_carrier;
nr_get_carrier_frequencies(&UE->frame_parms, &dl_carrier, &ul_carrier); nr_get_carrier_frequencies(&UE->frame_parms, &dl_carrier, &ul_carrier);
if (nr_initial_sync(&syncD->proc, UE, 2) == 0) { if (nr_initial_sync(&syncD->proc, UE, 2, get_softmodem_params()->sa, get_nrUE_params()->nr_dlsch_parallel) == 0) {
freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync freq_offset = UE->common_vars.freq_offset; // frequency offset computed with pss in initial sync
hw_slot_offset = ((UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe * UE->frame_parms.slots_per_subframe) + hw_slot_offset = ((UE->rx_offset<<1) / UE->frame_parms.samples_per_subframe * UE->frame_parms.slots_per_subframe) +
round((float)((UE->rx_offset<<1) % UE->frame_parms.samples_per_subframe)/UE->frame_parms.samples_per_slot0); round((float)((UE->rx_offset<<1) % UE->frame_parms.samples_per_subframe)/UE->frame_parms.samples_per_slot0);
...@@ -717,15 +717,18 @@ void *UE_thread(void *arg) { ...@@ -717,15 +717,18 @@ void *UE_thread(void *arg) {
if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) { if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) {
uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots; uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots;
int nrofUplinkSlots, nrofUplinkSymbols;
int nrofUplinkSlots = 0; if (mac->scc) {
if (mac->scc_SIB) nrofUplinkSlots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
nrofUplinkSlots = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; nrofUplinkSymbols = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
else if (mac->scc) }
nrofUplinkSlots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots; else {
nrofUplinkSlots = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
nrofUplinkSymbols = mac->scc_SIB->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols;
}
uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSymbols != 0);
uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSlots != 0);
uint8_t first_tx_slot = tdd_period - num_UL_slots; uint8_t first_tx_slot = tdd_period - num_UL_slots;
if (slot_tx_usrp % tdd_period == first_tx_slot) if (slot_tx_usrp % tdd_period == first_tx_slot)
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
//#include "common/utils/threadPool/thread-pool.h" //#include "common/utils/threadPool/thread-pool.h"
#include "common/utils/load_module_shlib.h" #include "common/utils/load_module_shlib.h"
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all //#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
#include "common/utils/nr/nr_common.h"
#include "../../ARCH/COMMON/common_lib.h" #include "../../ARCH/COMMON/common_lib.h"
#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" #include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
...@@ -279,7 +280,7 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ ...@@ -279,7 +280,7 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
UE->mode = normal_txrx; UE->mode = normal_txrx;
config_process_cmdline( cmdline_params,numparams,NULL); config_get(cmdline_params,numparams,NULL);
int pindex = config_paramidx_fromname(cmdline_params,numparams, CALIBRX_OPT); int pindex = config_paramidx_fromname(cmdline_params,numparams, CALIBRX_OPT);
if ( (cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0) UE->mode = rx_calib_ue; if ( (cmdline_params[pindex].paramflags & PARAMFLAG_PARAMSET) != 0) UE->mode = rx_calib_ue;
...@@ -318,22 +319,16 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){ ...@@ -318,22 +319,16 @@ void set_options(int CC_id, PHY_VARS_NR_UE *UE){
UE->rf_map.card = card_offset; UE->rf_map.card = card_offset;
UE->rf_map.chain = CC_id + chain_offset; UE->rf_map.chain = CC_id + chain_offset;
LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n, do_prb_interpolation %d\n", LOG_I(PHY,"Set UE mode %d, UE_fo_compensation %d, UE_scan_carrier %d, UE_no_timing_correction %d \n, do_prb_interpolation %d\n",
UE->mode, UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction, UE->prb_interpolation); UE->mode, UE->UE_fo_compensation, UE->UE_scan_carrier, UE->no_timing_correction, UE->prb_interpolation);
// Set FP variables // Set FP variables
if (tddflag){ if (tddflag){
fp->frame_type = TDD; fp->frame_type = TDD;
LOG_I(PHY, "Set UE frame_type %d\n", fp->frame_type); LOG_I(PHY, "Set UE frame_type %d\n", fp->frame_type);
} }
fp->N_RB_DL = N_RB_DL;
LOG_I(PHY, "Set UE N_RB_DL %d\n", N_RB_DL);
LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs); LOG_I(PHY, "Set UE nb_rx_antenna %d, nb_tx_antenna %d, threequarter_fs %d\n", fp->nb_antennas_rx, fp->nb_antennas_tx, fp->threequarter_fs);
fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor; fp->ofdm_offset_divisor = nrUE_params.ofdm_offset_divisor;
...@@ -469,34 +464,30 @@ int main( int argc, char **argv ) { ...@@ -469,34 +464,30 @@ int main( int argc, char **argv ) {
for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (int CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE)); PHY_vars_UE_g[0][CC_id] = (PHY_VARS_NR_UE *)malloc(sizeof(PHY_VARS_NR_UE));
UE[CC_id] = PHY_vars_UE_g[0][CC_id]; UE[CC_id] = PHY_vars_UE_g[0][CC_id];
memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE)); memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE));
set_options(CC_id, UE[CC_id]); set_options(CC_id, UE[CC_id]);
NR_UE_MAC_INST_t *mac = get_mac_inst(0); NR_UE_MAC_INST_t *mac = get_mac_inst(0);
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL)
mac->if_module->phy_config_request(&mac->phy_config); if (get_softmodem_params()->sa) {
uint16_t nr_band = get_band(downlink_frequency[CC_id][0],uplink_frequency_offset[CC_id][0]);
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config; mac->nr_band = nr_band;
if (get_softmodem_params()->sa) { // set frame config to initial values from command line and assume that the SSB is centered on the grid nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms,
nrUE_config->ssb_config.scs_common = get_softmodem_params()->numerology; downlink_frequency[CC_id][0],
nrUE_config->carrier_config.dl_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL; uplink_frequency_offset[CC_id][0],
nrUE_config->carrier_config.ul_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL; get_softmodem_params()->numerology,
nrUE_config->carrier_config.dl_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000; nr_band);
nrUE_config->carrier_config.uplink_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<<nrUE_config->ssb_config.scs_common)))/1000; }
nrUE_config->ssb_table.ssb_offset_point_a = (UE[CC_id]->frame_parms.N_RB_DL - 20)>>1; else{
if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL)
// Initialize values, will be updated upon SIB1 reception mac->if_module->phy_config_request(&mac->phy_config);
nrUE_config->cell_config.frame_duplex_type = TDD;
nrUE_config->ssb_table.ssb_mask_list[0].ssb_mask = 0xFFFFFFFF; fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
nrUE_config->ssb_table.ssb_period = 1;
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
} }
nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config,
mac->scc == NULL ? 78 : *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
init_symbol_rotation(&UE[CC_id]->frame_parms); init_symbol_rotation(&UE[CC_id]->frame_parms);
init_timeshift_rotation(&UE[CC_id]->frame_parms); init_timeshift_rotation(&UE[CC_id]->frame_parms);
......
...@@ -42,27 +42,28 @@ ...@@ -42,27 +42,28 @@
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
/*------------------------------------------------------------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------------------------------------------------------------*/
#define CMDLINE_NRUE_PHYPARAMS_DESC { \ #define CMDLINE_NRUE_PHYPARAMS_DESC { \
{ CALIBRX_OPT, CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ { CALIBRX_OPT, CONFIG_HLP_CALUER, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
{ CALIBRXMED_OPT, CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ { CALIBRXMED_OPT, CONFIG_HLP_CALUERM, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
{ CALIBRXBYP_OPT, CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \ { CALIBRXBYP_OPT, CONFIG_HLP_CALUERB, 0, iptr:&rx_input_level_dBm, defintval:0, TYPE_INT, 0}, \
{ DBGPRACH_OPT, CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ { DBGPRACH_OPT, CONFIG_HLP_DBGUEPR, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{ NOL2CONNECT_OPT, CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ { NOL2CONNECT_OPT, CONFIG_HLP_NOL2CN, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{CALIBPRACH_OPT, CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \ { CALIBPRACH_OPT, CONFIG_HLP_CALPRACH, PARAMFLAG_BOOL, uptr:NULL, defuintval:1, TYPE_INT, 0}, \
{ DUMPFRAME_OPT, CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \ { DUMPFRAME_OPT, CONFIG_HLP_DUMPFRAME, PARAMFLAG_BOOL, iptr:&dumpframe, defintval:0, TYPE_INT, 0}, \
{"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \ {"ue-rxgain", CONFIG_HLP_UERXG, 0, dblptr:&(rx_gain[0][0]), defdblval:0, TYPE_DOUBLE,0}, \
{"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE, 0}, \ {"ue-rxgain-off", CONFIG_HLP_UERXGOFF, 0, dblptr:&rx_gain_off, defdblval:0, TYPE_DOUBLE,0}, \
{"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE, 0}, \ {"ue-txgain", CONFIG_HLP_UETXG, 0, dblptr:&(tx_gain[0][0]), defdblval:0, TYPE_DOUBLE,0}, \
{"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \ {"ue-nb-ant-rx", CONFIG_HLP_UENANTR, 0, u8ptr:&(fp->nb_antennas_rx), defuintval:1, TYPE_UINT8, 0}, \
{"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \ {"ue-nb-ant-tx", CONFIG_HLP_UENANTT, 0, u8ptr:&(fp->nb_antennas_tx), defuintval:1, TYPE_UINT8, 0}, \
{"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \ {"ue-scan-carrier", CONFIG_HLP_UESCAN, PARAMFLAG_BOOL, iptr:&(UE->UE_scan_carrier), defintval:0, TYPE_INT, 0}, \
{"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&(UE->UE_fo_compensation), defintval:0, TYPE_INT, 0}, \ {"ue-fo-compensation", CONFIG_HLP_UEFO, PARAMFLAG_BOOL, iptr:&(UE->UE_fo_compensation), defintval:0, TYPE_INT, 0}, \
{"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \ {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:90, TYPE_INT, 0}, \
{"r" , CONFIG_HLP_PRB, 0, uptr:&(N_RB_DL), defuintval:160, TYPE_UINT, 0}, \ {"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \
{"A" , CONFIG_HLP_TADV, 0, iptr:&(UE->timing_advance), defintval:0, TYPE_INT, 0}, \ {"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, u8ptr:&(fp->threequarter_fs), defintval:0, TYPE_UINT8, 0}, \
{"E" , CONFIG_HLP_TQFS, PARAMFLAG_BOOL, u8ptr:&(fp->threequarter_fs), defintval:0, TYPE_UINT8, 0}, \ {"r" , CONFIG_HLP_PRB_SA, 0, iptr:&(fp->N_RB_DL), defintval:106, TYPE_UINT, 0}, \
{"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ {"s" , CONFIG_HLP_SSC, 0, u16ptr:&(fp->ssb_start_subcarrier), defintval:516, TYPE_UINT16,0}, \
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \
{"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&(UE->prb_interpolation), defintval:0, TYPE_INT, 0}, \ {"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&(UE->prb_interpolation), defintval:0, TYPE_INT, 0}, \
{"ue-timing-correction-disable", CONFIG_HLP_DISABLETIMECORR, PARAMFLAG_BOOL, iptr:&(UE->no_timing_correction), defintval:0, TYPE_INT, 0}, \
} }
......
...@@ -139,8 +139,8 @@ extern int usrp_tx_thread; ...@@ -139,8 +139,8 @@ extern int usrp_tx_thread;
{"time-source", CONFIG_HLP_TME, 0, uptr:&TIMING_SOURCE, defintval:0, TYPE_UINT, 0}, \ {"time-source", CONFIG_HLP_TME, 0, uptr:&TIMING_SOURCE, defintval:0, TYPE_UINT, 0}, \
{"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \ {"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&WAIT_FOR_SYNC, defintval:0, TYPE_INT, 0}, \
{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \ {"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&SINGLE_THREAD_FLAG, defintval:0, TYPE_INT, 0}, \
{"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:3619200000, TYPE_UINT64, 0}, \ {"C" , CONFIG_HLP_DLF, 0, u64ptr:&(downlink_frequency[0][0]), defuintval:0, TYPE_UINT64, 0}, \
{"CO" , CONFIG_HLP_ULF, 0, iptr:&(uplink_frequency_offset[0][0]), defintval:0, TYPE_INT, 0}, \ {"CO" , CONFIG_HLP_ULF, 0, iptr:&(uplink_frequency_offset[0][0]), defintval:0, TYPE_INT, 0}, \
{"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \ {"a" , CONFIG_HLP_CHOFF, 0, iptr:&CHAIN_OFFSET, defintval:0, TYPE_INT, 0}, \
{"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \ {"d" , CONFIG_HLP_SOFTS, PARAMFLAG_BOOL, uptr:(uint32_t *)&do_forms, defintval:0, TYPE_INT8, 0}, \
{"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \ {"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \
...@@ -155,10 +155,10 @@ extern int usrp_tx_thread; ...@@ -155,10 +155,10 @@ extern int usrp_tx_thread;
{"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \ {"nokrnmod", CONFIG_HLP_NOKRNMOD, PARAMFLAG_BOOL, uptr:&nokrnmod, defintval:0, TYPE_INT, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \ {"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, uptr:&nonbiot, defuintval:0, TYPE_INT, 0}, \
{"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \ {"use-256qam-table", CONFIG_HLP_256QAM, PARAMFLAG_BOOL, iptr:&USE_256QAM_TABLE, defintval:0, TYPE_INT, 0}, \
{"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&PRB_INTERPOLATION, defintval:0, TYPE_INT, 0}, \ {"do-prb-interpolation", CONFIG_HLP_PRBINTER, PARAMFLAG_BOOL, iptr:&PRB_INTERPOLATION, defintval:0, TYPE_INT, 0}, \
{"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ {"usrp-tx-thread-config",CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \
{"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \
{"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \ {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \
} }
......
...@@ -46,42 +46,6 @@ ...@@ -46,42 +46,6 @@
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h" #include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
static
uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex)
{
const uint64_t dl_freq_khz = downlink_frequency / 1000;
const int32_t delta_duplex_khz = delta_duplex / 1000;
uint64_t center_freq_diff_khz = 999999999999999999; // 2^64
uint16_t current_band = 0;
for (int ind = 0; ind < nr_bandtable_size; ind++) {
LOG_D(PHY, "Scanning band %d, dl_min %"PRIu64", ul_min %"PRIu64"\n", nr_bandtable[ind].band, nr_bandtable[ind].dl_min, nr_bandtable[ind].ul_min);
if (dl_freq_khz < nr_bandtable[ind].dl_min || dl_freq_khz > nr_bandtable[ind].dl_max)
continue;
int32_t current_offset_khz = nr_bandtable[ind].ul_min - nr_bandtable[ind].dl_min;
if (current_offset_khz != delta_duplex_khz)
continue;
uint64_t center_frequency_khz = (nr_bandtable[ind].dl_max + nr_bandtable[ind].dl_min) / 2;
if (abs(dl_freq_khz - center_frequency_khz) < center_freq_diff_khz){
current_band = nr_bandtable[ind].band;
center_freq_diff_khz = abs(dl_freq_khz - center_frequency_khz);
}
}
LOG_I(PHY, "DL frequency %"PRIu64": band %d, UL frequency %"PRIu64"\n",
downlink_frequency, current_band, downlink_frequency+delta_duplex);
AssertFatal(current_band != 0, "Can't find EUTRA band for frequency %"PRIu64" and duplex_spacing %u\n", downlink_frequency, delta_duplex);
return current_band;
}
int l1_north_init_gNB() { int l1_north_init_gNB() {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include "phy_init.h" #include "phy_init.h"
#include "common/utils/nr/nr_common.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h"
...@@ -27,6 +28,20 @@ ...@@ -27,6 +28,20 @@
uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3}; uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3};
uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16}; uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16};
void set_Lmax(NR_DL_FRAME_PARMS *fp) {
// definition of Lmax according to ts 38.213 section 4.1
if (fp->dl_CarrierFreq < 6e9) {
if(fp->frame_type && (fp->ssb_type==2))
fp->Lmax = (fp->dl_CarrierFreq < 2.4e9)? 4 : 8;
else
fp->Lmax = (fp->dl_CarrierFreq < 3e9)? 4 : 8;
} else {
fp->Lmax = 64;
}
}
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb) { int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb) {
int mu = fp->numerology_index; int mu = fp->numerology_index;
...@@ -217,15 +232,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, ...@@ -217,15 +232,7 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
fp->Ncp = Ncp; fp->Ncp = Ncp;
// definition of Lmax according to ts 38.213 section 4.1 set_Lmax(fp);
if (fp->dl_CarrierFreq < 6e9) {
if(fp->frame_type && (fp->ssb_type==2))
fp->Lmax = (fp->dl_CarrierFreq < 2.4e9)? 4 : 8;
else
fp->Lmax = (fp->dl_CarrierFreq < 3e9)? 4 : 8;
} else {
fp->Lmax = 64;
}
fp->N_ssb = 0; fp->N_ssb = 0;
int num_tx_ant = cfg->carrier_config.num_tx_ant.value; int num_tx_ant = cfg->carrier_config.num_tx_ant.value;
...@@ -316,16 +323,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, ...@@ -316,16 +323,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
sco = config->ssb_table.ssb_subcarrier_offset; sco = config->ssb_table.ssb_subcarrier_offset;
fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + sco); fp->ssb_start_subcarrier = (12 * config->ssb_table.ssb_offset_point_a + sco);
set_Lmax(fp);
// definition of Lmax according to ts 38.213 section 4.1
if (fp->dl_CarrierFreq < 6e9) {
if(fp->frame_type && (fp->ssb_type==2))
fp->Lmax = (fp->dl_CarrierFreq < 2.4e9)? 4 : 8;
else
fp->Lmax = (fp->dl_CarrierFreq < 3e9)? 4 : 8;
} else {
fp->Lmax = 64;
}
fp->L_ssb = (((uint64_t) config->ssb_table.ssb_mask_list[0].ssb_mask)<<32) | config->ssb_table.ssb_mask_list[1].ssb_mask; fp->L_ssb = (((uint64_t) config->ssb_table.ssb_mask_list[0].ssb_mask)<<32) | config->ssb_table.ssb_mask_list[1].ssb_mask;
...@@ -336,6 +334,43 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, ...@@ -336,6 +334,43 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
return 0; return 0;
} }
void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t delta_duplex, uint8_t mu, uint16_t nr_band) {
LOG_I(PHY,"SA init parameters. DL freq %lu UL offset %d SSB numerology %d N_RB_DL %d\n",
downlink_frequency,
delta_duplex,
mu,
frame_parms->N_RB_DL);
frame_parms->numerology_index = mu;
frame_parms->dl_CarrierFreq = downlink_frequency;
frame_parms->ul_CarrierFreq = downlink_frequency + delta_duplex;
frame_parms->freq_range = (frame_parms->dl_CarrierFreq < 6e9)? nr_FR1 : nr_FR2;
frame_parms->N_RB_UL = frame_parms->N_RB_DL;
frame_parms->nr_band = nr_band;
frame_parms->frame_type = get_frame_type(frame_parms->nr_band, frame_parms->numerology_index);
frame_parms->Ncp = NORMAL;
set_scs_parameters(frame_parms, frame_parms->numerology_index, frame_parms->N_RB_DL);
set_Lmax(frame_parms);
frame_parms->slots_per_frame = 10* frame_parms->slots_per_subframe;
frame_parms->symbols_per_slot = ((frame_parms->Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats
frame_parms->samples_per_subframe_wCP = frame_parms->ofdm_symbol_size * frame_parms->symbols_per_slot * frame_parms->slots_per_subframe;
frame_parms->samples_per_frame_wCP = 10 * frame_parms->samples_per_subframe_wCP;
frame_parms->samples_per_slot_wCP = frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size;
frame_parms->samples_per_slotN0 = (frame_parms->nb_prefix_samples + frame_parms->ofdm_symbol_size) * frame_parms->symbols_per_slot;
frame_parms->samples_per_slot0 = frame_parms->nb_prefix_samples0 + ((frame_parms->symbols_per_slot-1)*frame_parms->nb_prefix_samples) + (frame_parms->symbols_per_slot*frame_parms->ofdm_symbol_size);
frame_parms->samples_per_subframe = (frame_parms->nb_prefix_samples0 + frame_parms->ofdm_symbol_size) * 2 +
(frame_parms->nb_prefix_samples + frame_parms->ofdm_symbol_size) * (frame_parms->symbols_per_slot * frame_parms->slots_per_subframe - 2);
frame_parms->get_samples_per_slot = &get_samples_per_slot;
frame_parms->get_samples_slot_timestamp = &get_samples_slot_timestamp;
frame_parms->samples_per_frame = 10 * frame_parms->samples_per_subframe;
}
void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp) void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp)
{ {
LOG_I(PHY,"fp->scs=%d\n",fp->subcarrier_spacing); LOG_I(PHY,"fp->scs=%d\n",fp->subcarrier_spacing);
......
...@@ -389,12 +389,12 @@ void phy_config_request(PHY_Config_t *phy_config); ...@@ -389,12 +389,12 @@ void phy_config_request(PHY_Config_t *phy_config);
void phy_config_update_sib2_request(PHY_Config_t *phy_config); void phy_config_update_sib2_request(PHY_Config_t *phy_config);
void phy_config_update_sib13_request(PHY_Config_t *phy_config); void phy_config_update_sib13_request(PHY_Config_t *phy_config);
int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf); int init_frame_parms(LTE_DL_FRAME_PARMS *frame_parms,uint8_t osf);
void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms); void dump_frame_parms(LTE_DL_FRAME_PARMS *frame_parms);
int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb); int nr_get_ssb_start_symbol(NR_DL_FRAME_PARMS *fp,uint8_t i_ssb);
int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms); int nr_init_frame_parms(nfapi_nr_config_request_scf_t *config, NR_DL_FRAME_PARMS *frame_parms);
int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band); int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *frame_parms, fapi_nr_config_request_t *config, uint16_t nr_band);
void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, uint64_t downlink_frequency, int32_t uplink_frequency_offset, uint8_t mu, uint16_t nr_band);
int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag); int init_nr_ue_signal(PHY_VARS_NR_UE *ue,int nb_connected_eNB,uint8_t abstraction_flag);
void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag); void init_nr_ue_transport(PHY_VARS_NR_UE *ue,int abstraction_flag);
void init_N_TA_offset(PHY_VARS_NR_UE *ue); void init_N_TA_offset(PHY_VARS_NR_UE *ue);
......
...@@ -1527,7 +1527,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB, ...@@ -1527,7 +1527,9 @@ void fill_dci_and_dlsch(PHY_VARS_eNB *eNB,
if (dlsch0->active) if (dlsch0->active)
T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame), T_INT(subframe), T(T_ENB_PHY_DLSCH_UE_DCI, T_INT(0), T_INT(frame), T_INT(subframe),
T_INT(rel8->rnti), T_INT(rel8->dci_format), T_INT(rel8->harq_process), T_INT(rel8->rnti), T_INT(rel8->dci_format), T_INT(rel8->harq_process),
T_INT(rel8->mcs_1), T_INT(dlsch0_harq->TBS)); T_INT(rel8->mcs_1), T_INT(dlsch0_harq->TBS), T_INT(rel8->new_data_indicator_1),
T_INT(rel8->redundancy_version_1), T_INT(rel8->resource_block_coding),
T_INT(dlsch0_harq->nb_rb), T_INT(dlsch0_harq->rb_alloc[0]));
#endif #endif
} }
......
...@@ -213,7 +213,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB, ...@@ -213,7 +213,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
nr_pdsch_codeword_scrambling_optim(harq->f, nr_pdsch_codeword_scrambling_optim(harq->f,
encoded_length, encoded_length,
q, q,
rel15->dlDmrsScramblingId, rel15->dataScramblingId,
rel15->rnti, rel15->rnti,
scrambled_output[q]); scrambled_output[q]);
......
...@@ -292,7 +292,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, ...@@ -292,7 +292,8 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB,
} }
G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers); G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, length_dmrs,mod_order,rel15->nrOfLayers);
LOG_D(NR_PHY,"dlsch coding A %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d)\n", A,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,mod_order); LOG_D(PHY,"dlsch coding A %d G %d (nb_rb %d, nb_symb_sch %d, nb_re_dmrs %d, length_dmrs %d, mod_order %d)\n",
A,G, nb_rb,nb_symb_sch,nb_re_dmrs,length_dmrs,(int)mod_order);
if (A > 3824) { if (A > 3824) {
// Add 24-bit crc (polynomial A) to payload // Add 24-bit crc (polynomial A) to payload
......
This diff is collapsed.
...@@ -155,7 +155,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint ...@@ -155,7 +155,7 @@ NR_UE_DLSCH_t *new_nr_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint
if (dlsch->harq_processes[i]) { if (dlsch->harq_processes[i]) {
memset(dlsch->harq_processes[i],0,sizeof(NR_DL_UE_HARQ_t)); memset(dlsch->harq_processes[i],0,sizeof(NR_DL_UE_HARQ_t));
init_downlink_harq_status(dlsch->harq_processes[i]); init_downlink_harq_status(dlsch->harq_processes[i]);
dlsch->harq_processes[i]->first_tx=1; dlsch->harq_processes[i]->first_rx=1;
dlsch->harq_processes[i]->b = (uint8_t *)malloc16(dlsch_bytes); dlsch->harq_processes[i]->b = (uint8_t *)malloc16(dlsch_bytes);
if (dlsch->harq_processes[i]->b) if (dlsch->harq_processes[i]->b)
...@@ -327,7 +327,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -327,7 +327,9 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
dlsch->last_iteration_cnt = ret; dlsch->last_iteration_cnt = ret;
harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, dmrs_length, harq_process->Qm,harq_process->Nl); harq_process->G = nr_get_G(nb_rb, nb_symb_sch, nb_re_dmrs, dmrs_length, harq_process->Qm,harq_process->Nl);
G = harq_process->G; G = harq_process->G;
LOG_D(PHY,"DLSCH Decoding, harq_pid %d TBS %d (%d) G %d nb_re_dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",harq_pid,A,A/8,G, nb_re_dmrs,harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb);
LOG_D(PHY,"DLSCH Decoding, harq_pid %d TBS %d (%d) G %d nb_re_dmrs %d length dmrs %d mcs %d Nl %d nb_symb_sch %d nb_rb %d\n",
harq_pid,A,A/8,G, nb_re_dmrs, dmrs_length, harq_process->mcs, harq_process->Nl, nb_symb_sch,nb_rb);
if ((harq_process->R)<1024) if ((harq_process->R)<1024)
Coderate = (float) (harq_process->R) /(float) 1024; Coderate = (float) (harq_process->R) /(float) 1024;
...@@ -358,7 +360,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -358,7 +360,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
} }
} }
if (harq_process->round == 0) { if (harq_process->first_rx == 1) {
// This is a new packet, so compute quantities regarding segmentation // This is a new packet, so compute quantities regarding segmentation
if (A > NR_MAX_PDSCH_TBS) if (A > NR_MAX_PDSCH_TBS)
harq_process->B = A+24; harq_process->B = A+24;
...@@ -448,7 +450,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -448,7 +450,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->w[r], harq_process->w[r],
harq_process->C, harq_process->C,
harq_process->rvidx, harq_process->rvidx,
(harq_process->round==0)?1:0, (harq_process->first_rx==1)?1:0,
E, E,
harq_process->F, harq_process->F,
Kr-harq_process->F-2*(p_decParams->Z))==-1) { Kr-harq_process->F-2*(p_decParams->Z))==-1) {
...@@ -771,7 +773,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -771,7 +773,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
} }
} }
if (harq_process->round == 0) { if (harq_process->first_rx == 1) {
// This is a new packet, so compute quantities regarding segmentation // This is a new packet, so compute quantities regarding segmentation
if (A > NR_MAX_PDSCH_TBS) if (A > NR_MAX_PDSCH_TBS)
harq_process->B = A+24; harq_process->B = A+24;
...@@ -909,7 +911,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -909,7 +911,7 @@ uint32_t nr_dlsch_decoding_mthread(PHY_VARS_NR_UE *phy_vars_ue,
harq_process->w[r], harq_process->w[r],
harq_process->C, harq_process->C,
harq_process->rvidx, harq_process->rvidx,
(harq_process->round==0)?1:0, (harq_process->first_rx==1)?1:0,
E, E,
harq_process->F, harq_process->F,
Kr-harq_process->F-2*(p_decParams->Z))==-1) { Kr-harq_process->F-2*(p_decParams->Z))==-1) {
...@@ -1229,25 +1231,23 @@ void nr_dlsch_decoding_process(void *arg) { ...@@ -1229,25 +1231,23 @@ void nr_dlsch_decoding_process(void *arg) {
} }
} }
harq_process->round =0; if (harq_process->first_rx == 1) {
// This is a new packet, so compute quantities regarding segmentation
if (A > NR_MAX_PDSCH_TBS)
harq_process->B = A+24;
else
harq_process->B = A+16;
// if (harq_process->round == 0) { nr_segmentation(NULL,
// This is a new packet, so compute quantities regarding segmentation NULL,
if (A > NR_MAX_PDSCH_TBS) harq_process->B,
harq_process->B = A+24; &harq_process->C,
else &harq_process->K,
harq_process->B = A+16; &harq_process->Z,
&harq_process->F,
nr_segmentation(NULL, p_decParams->BG);
NULL, p_decParams->Z = harq_process->Z;
harq_process->B, }
&harq_process->C,
&harq_process->K,
&harq_process->Z,
&harq_process->F,
p_decParams->BG);
p_decParams->Z = harq_process->Z;
// }
LOG_D(PHY,"round %d Z %d K %d BG %d\n", harq_process->round, p_decParams->Z, harq_process->K, p_decParams->BG); LOG_D(PHY,"round %d Z %d K %d BG %d\n", harq_process->round, p_decParams->Z, harq_process->K, p_decParams->BG);
p_decParams->numMaxIter = dlsch->max_ldpc_iterations; p_decParams->numMaxIter = dlsch->max_ldpc_iterations;
p_decParams->outMode= 0; p_decParams->outMode= 0;
...@@ -1314,7 +1314,7 @@ void nr_dlsch_decoding_process(void *arg) { ...@@ -1314,7 +1314,7 @@ void nr_dlsch_decoding_process(void *arg) {
harq_process->w[r], harq_process->w[r],
harq_process->C, harq_process->C,
harq_process->rvidx, harq_process->rvidx,
(harq_process->round==0)?1:0, (harq_process->first_rx==1)?1:0,
E, E,
harq_process->F, harq_process->F,
Kr-harq_process->F-2*(p_decParams->Z))==-1) { Kr-harq_process->F-2*(p_decParams->Z))==-1) {
......
...@@ -738,11 +738,11 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -738,11 +738,11 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
} }
void nr_dlsch_deinterleaving(uint8_t symbol, void nr_dlsch_deinterleaving(uint8_t symbol,
uint8_t start_symbol, uint8_t start_symbol,
uint16_t L, uint16_t L,
uint16_t *llr, uint16_t *llr,
uint16_t *llr_deint, uint16_t *llr_deint,
uint16_t nb_rb_pdsch) uint16_t nb_rb_pdsch)
{ {
uint32_t bundle_idx, N_bundle, R, C, r,c; uint32_t bundle_idx, N_bundle, R, C, r,c;
......
...@@ -36,8 +36,7 @@ ...@@ -36,8 +36,7 @@
#include "PHY/MODULATION/modulation_UE.h" #include "PHY/MODULATION/modulation_UE.h"
#include "nr_transport_proto_ue.h" #include "nr_transport_proto_ue.h"
#include "PHY/NR_UE_ESTIMATION/nr_estimation.h" #include "PHY/NR_UE_ESTIMATION/nr_estimation.h"
//#include "SCHED/defs.h" #include "SCHED_NR_UE/defs.h"
//#include "SCHED/extern.h"
#include "common/utils/LOG/vcd_signal_dumper.h" #include "common/utils/LOG/vcd_signal_dumper.h"
#include "common_lib.h" #include "common_lib.h"
...@@ -46,6 +45,7 @@ ...@@ -46,6 +45,7 @@
#include "PHY/NR_REFSIG/pss_nr.h" #include "PHY/NR_REFSIG/pss_nr.h"
#include "PHY/NR_REFSIG/sss_nr.h" #include "PHY/NR_REFSIG/sss_nr.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "PHY/NR_TRANSPORT/nr_dci.h"
extern openair0_config_t openair0_cfg[]; extern openair0_config_t openair0_cfg[];
//static nfapi_nr_config_request_t config_t; //static nfapi_nr_config_request_t config_t;
...@@ -201,7 +201,10 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini ...@@ -201,7 +201,10 @@ int nr_pbch_detection(UE_nr_rxtx_proc_t * proc, PHY_VARS_NR_UE *ue, int pbch_ini
char duplex_string[2][4] = {"FDD","TDD"}; char duplex_string[2][4] = {"FDD","TDD"};
char prefix_string[2][9] = {"NORMAL","EXTENDED"}; char prefix_string[2][9] = {"NORMAL","EXTENDED"};
int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
PHY_VARS_NR_UE *ue,
int n_frames, int sa,
int dlsch_parallel)
{ {
int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2, int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2,
...@@ -349,7 +352,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) ...@@ -349,7 +352,7 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames)
} }
} }
else { else {
ret = -1; ret = -1;
} }
/* Consider this is a false detection if the offset is > 1000 Hz /* Consider this is a false detection if the offset is > 1000 Hz
...@@ -479,6 +482,76 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames) ...@@ -479,6 +482,76 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, PHY_VARS_NR_UE *ue, int n_frames)
} }
// if stand alone and sync on ssb do sib1 detection as part of initial sync
if (sa==1 && ret==0) {
bool dec = false;
NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[proc->thread_id][0];
int gnb_id = 0; //FIXME
int coreset_nb_rb=0;
int coreset_start_rb=0;
for(int n_ss = 0; n_ss<pdcch_vars->nb_search_space; n_ss++) {
uint8_t nb_symb_pdcch = pdcch_vars->pdcch_config[n_ss].coreset.duration;
get_coreset_rballoc(pdcch_vars->pdcch_config[n_ss].coreset.frequency_domain_resource,&coreset_nb_rb,&coreset_start_rb);
for (uint16_t l=0; l<nb_symb_pdcch; l++) {
nr_slot_fep_init_sync(ue,
proc,
l, // the UE PHY has no notion of the symbols to be monitored in the search space
pdcch_vars->slot,
is*fp->samples_per_frame+pdcch_vars->sfn*fp->samples_per_frame+ue->rx_offset);
if (coreset_nb_rb > 0)
nr_pdcch_channel_estimation(ue,
proc,
0,
pdcch_vars->slot,
l,
fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12,
coreset_nb_rb);
}
int dci_cnt = nr_ue_pdcch_procedures(gnb_id, ue, proc, n_ss);
if (dci_cnt>0){
NR_UE_DLSCH_t *dlsch = ue->dlsch_SI[gnb_id];
if (dlsch && (dlsch->active == 1)) {
uint8_t harq_pid = dlsch->current_harq_pid;
NR_DL_UE_HARQ_t *dlsch0_harq = dlsch->harq_processes[harq_pid];
uint16_t nb_symb_sch = dlsch0_harq->nb_symbols;
uint16_t start_symb_sch = dlsch0_harq->start_symbol;
for (uint16_t m=start_symb_sch;m<(nb_symb_sch+start_symb_sch) ; m++){
nr_slot_fep_init_sync(ue,
proc,
m,
pdcch_vars->slot, // same slot and offset as pdcch
is*fp->samples_per_frame+pdcch_vars->sfn*fp->samples_per_frame+ue->rx_offset);
}
int ret = nr_ue_pdsch_procedures(ue,
proc,
gnb_id,
SI_PDSCH,
ue->dlsch_SI[gnb_id],
NULL);
if (ret >= 0)
dec = nr_ue_dlsch_procedures(ue,
proc,
gnb_id,
SI_PDSCH,
ue->dlsch_SI[gnb_id],
NULL,
&ue->dlsch_SI_errors[gnb_id],
dlsch_parallel);
// deactivate dlsch once dlsch proc is done
ue->dlsch_SI[gnb_id]->active = 0;
}
}
}
if (dec == false) // sib1 not decoded
ret = -1;
}
// exit_fun("debug exit"); // exit_fun("debug exit");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC, VCD_FUNCTION_OUT);
return ret; return ret;
......
...@@ -1120,7 +1120,8 @@ uint32_t dlsch_decoding_emul(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -1120,7 +1120,8 @@ uint32_t dlsch_decoding_emul(PHY_VARS_NR_UE *phy_vars_ue,
uint8_t eNB_id); uint8_t eNB_id);
int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue, int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc); UE_nr_rxtx_proc_t *proc,
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
/*! \brief Extract PSS and SSS resource elements /*! \brief Extract PSS and SSS resource elements
...@@ -1455,7 +1456,9 @@ void generate_RIV_tables(void); ...@@ -1455,7 +1456,9 @@ void generate_RIV_tables(void);
*/ */
int nr_initial_sync(UE_nr_rxtx_proc_t *proc, int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
PHY_VARS_NR_UE *phy_vars_ue, PHY_VARS_NR_UE *phy_vars_ue,
int n_frames); int n_frames,
int sa,
int dlsch_parallel);
/*! /*!
\brief This function gets the carrier frequencies either from FP or command-line-set global variables, depending on the availability of the latter \brief This function gets the carrier frequencies either from FP or command-line-set global variables, depending on the availability of the latter
...@@ -1709,7 +1712,8 @@ uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset); ...@@ -1709,7 +1712,8 @@ uint32_t lte_gold_generic(uint32_t *x1, uint32_t *x2, uint8_t reset);
uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
fapi_nr_dci_indication_t *dci_ind); fapi_nr_dci_indication_t *dci_ind,
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
/** \brief This function is the top-level entry point to PDSCH demodulation, after frequency-domain transformation and channel estimation. It performs /** \brief This function is the top-level entry point to PDSCH demodulation, after frequency-domain transformation and channel estimation. It performs
...@@ -1745,6 +1749,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue, ...@@ -1745,6 +1749,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t subframe); int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t subframe);
void dump_nrdlsch(PHY_VARS_NR_UE *ue,uint8_t gNB_id,uint8_t nr_slot_rx,unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid);
void *dlsch_thread(void *arg); void *dlsch_thread(void *arg);
/**@}*/ /**@}*/
#endif #endif
......
...@@ -206,8 +206,8 @@ typedef struct { ...@@ -206,8 +206,8 @@ typedef struct {
} NR_UE_ULSCH_t; } NR_UE_ULSCH_t;
typedef struct { typedef struct {
/// Indicator of first transmission /// Indicator of first reception
uint8_t first_tx; uint8_t first_rx;
/// Last Ndi received for this process on DCI (used for C-RNTI only) /// Last Ndi received for this process on DCI (used for C-RNTI only)
uint8_t DCINdi; uint8_t DCINdi;
/// DLSCH status flag indicating /// DLSCH status flag indicating
......
...@@ -318,7 +318,7 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue, ...@@ -318,7 +318,7 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue,
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR], int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR], int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
uint8_t doPss, uint8_t doSss, uint8_t doPss, uint8_t doSss,
uint8_t subframe) // add flag to indicate extracting only PSS, only SSS, or both uint8_t subframe) // add flag to indicate extracting only PSS, only SSS, or both
{ {
uint8_t aarx; uint8_t aarx;
int32_t *pss_rxF,*pss_rxF_ext; int32_t *pss_rxF,*pss_rxF_ext;
...@@ -329,8 +329,8 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue, ...@@ -329,8 +329,8 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue,
for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) { for (aarx=0; aarx<frame_parms->nb_antennas_rx; aarx++) {
pss_symbol = 0; pss_symbol = 0;
sss_symbol = SSS_SYMBOL_NB-PSS_SYMBOL_NB; sss_symbol = SSS_SYMBOL_NB-PSS_SYMBOL_NB;
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF; rxdataF = ue->common_vars.common_vars_rx_data_per_thread[proc->thread_id].rxdataF;
...@@ -343,6 +343,7 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue, ...@@ -343,6 +343,7 @@ int do_pss_sss_extract_nr(PHY_VARS_NR_UE *ue,
sss_rxF_ext = &sss_ext[aarx][0]; sss_rxF_ext = &sss_ext[aarx][0];
unsigned int k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56; unsigned int k = frame_parms->first_carrier_offset + frame_parms->ssb_start_subcarrier + 56;
if (k>= frame_parms->ofdm_symbol_size) k-=frame_parms->ofdm_symbol_size; if (k>= frame_parms->ofdm_symbol_size) k-=frame_parms->ofdm_symbol_size;
for (int i=0; i < LENGTH_PSS_NR; i++) { for (int i=0; i < LENGTH_PSS_NR; i++) {
...@@ -401,7 +402,7 @@ int pss_sss_extract_nr(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -401,7 +402,7 @@ int pss_sss_extract_nr(PHY_VARS_NR_UE *phy_vars_ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR], int32_t pss_ext[NB_ANTENNAS_RX][LENGTH_PSS_NR],
int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR], int32_t sss_ext[NB_ANTENNAS_RX][LENGTH_SSS_NR],
uint8_t subframe) uint8_t subframe)
{ {
return do_pss_sss_extract_nr(phy_vars_ue, proc, pss_ext, sss_ext, 1 /* doPss */, 1 /* doSss */, subframe); return do_pss_sss_extract_nr(phy_vars_ue, proc, pss_ext, sss_ext, 1 /* doPss */, 1 /* doSss */, subframe);
} }
......
...@@ -639,6 +639,9 @@ typedef struct { ...@@ -639,6 +639,9 @@ typedef struct {
uint8_t agregationLevel; uint8_t agregationLevel;
int nb_search_space; int nb_search_space;
fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS_PER_CORESET]; fapi_nr_dl_config_dci_dl_pdu_rel15_t pdcch_config[FAPI_NR_MAX_SS_PER_CORESET];
// frame and slot for sib1 in initial sync
uint16_t sfn;
uint16_t slot;
/* /*
#ifdef NR_PDCCH_DEFS_NR_UE #ifdef NR_PDCCH_DEFS_NR_UE
int nb_searchSpaces; int nb_searchSpaces;
......
...@@ -420,6 +420,25 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, ...@@ -420,6 +420,25 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
NR_UE_DLSCH_t *dlsch1, NR_UE_DLSCH_t *dlsch1,
uint16_t n_pdus); uint16_t n_pdus);
bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int gNB_id,
PDSCH_t pdsch,
NR_UE_DLSCH_t *dlsch0,
NR_UE_DLSCH_t *dlsch1,
int *dlsch_errors,
uint8_t dlsch_parallel);
int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int eNB_id, PDSCH_t pdsch,
NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1);
int nr_ue_pdcch_procedures(uint8_t gNB_id,
PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int n_ss);
#endif #endif
...@@ -78,6 +78,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -78,6 +78,8 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15; fapi_nr_dl_config_dci_dl_pdu_rel15_t *pdcch_config = &dl_config->dl_config_list[i].dci_config_pdu.dci_config_rel15;
memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config)); memcpy((void*)&pdcch_vars->pdcch_config[pdcch_vars->nb_search_space],(void*)pdcch_config,sizeof(*pdcch_config));
pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1; pdcch_vars->nb_search_space = pdcch_vars->nb_search_space + 1;
pdcch_vars->sfn = scheduled_response->frame;
pdcch_vars->slot = slot;
LOG_D(PHY,"Number of DCI SearchSpaces %d\n",pdcch_vars->nb_search_space); LOG_D(PHY,"Number of DCI SearchSpaces %d\n",pdcch_vars->nb_search_space);
} else { } else {
...@@ -127,7 +129,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ ...@@ -127,7 +129,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){
} }
dlsch0_harq->Nl = Nl; dlsch0_harq->Nl = Nl;
dlsch0_harq->mcs_table=dlsch_config_pdu->mcs_table; dlsch0_harq->mcs_table=dlsch_config_pdu->mcs_table;
downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch0->rnti_type); downlink_harq_process(dlsch0_harq, dlsch0->current_harq_pid, dlsch_config_pdu->ndi, dlsch_config_pdu->rv, dlsch0->rnti_type);
if (dlsch0_harq->status != ACTIVE) { if (dlsch0_harq->status != ACTIVE) {
// dlsch0_harq->status not ACTIVE may be due to false retransmission. Reset the // dlsch0_harq->status not ACTIVE may be due to false retransmission. Reset the
// following flag to skip PDSCH procedures in that case. // following flag to skip PDSCH procedures in that case.
......
...@@ -306,8 +306,9 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u ...@@ -306,8 +306,9 @@ harq_result_t uplink_harq_process(NR_UE_ULSCH_t *ulsch, int harq_pid, int ndi, u
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq)
{ {
dl_harq->status = SCH_IDLE; dl_harq->status = SCH_IDLE;
dl_harq->first_tx = 1; dl_harq->first_rx = 1;
dl_harq->round = 0; dl_harq->round = 0;
dl_harq->DCINdi = 1;
dl_harq->ack = DL_ACKNACK_NO_SET; dl_harq->ack = DL_ACKNACK_NO_SET;
} }
...@@ -328,39 +329,66 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) ...@@ -328,39 +329,66 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq)
* *
*********************************************************************/ *********************************************************************/
void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, uint8_t rnti_type) { void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int ndi, int rv, uint8_t rnti_type) {
if (rnti_type == _CS_RNTI_) {
LOG_E(PHY, "Fatal error in HARQ entity due to not supported CS_RNTI at line %d in function %s of file %s \n", __LINE__ , __func__, __FILE__);
return;
}
else if ((rnti_type != _C_RNTI_) && (rnti_type != _TC_RNTI_)) {
/* harq mechanism is not relevant for other rnti */
return;
}
if (dl_harq->first_tx == 1) { if (rnti_type == _SI_RNTI_ ||
rnti_type == _P_RNTI_ ||
rnti_type == _RA_RNTI_) {
dl_harq->round = 0; dl_harq->round = 0;
dl_harq->status = ACTIVE; dl_harq->status = ACTIVE;
dl_harq->DCINdi = ndi; dl_harq->first_rx = 1;
dl_harq->first_tx = 0;
LOG_D(PHY, "[HARQ-DL-PDSCH harqId : %d] first new reception \n", harq_pid);
} }
else if (dl_harq->DCINdi != ndi) { else{
dl_harq->round = 0; switch(rv){
dl_harq->status = ACTIVE; case 0:
dl_harq->DCINdi = ndi; dl_harq->round = 0;
dl_harq->status = ACTIVE;
LOG_D(PHY, "[HARQ-DL-PDSCH harqId : %d] new reception due to toogle of ndi \n", harq_pid); 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 = 2;
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->status = ACTIVE;
dl_harq->first_rx = 1;
dl_harq->DCINdi = ndi;
}
else if (dl_harq->ack)
dl_harq->status = SCH_IDLE;
break;
case 2:
dl_harq->round = 1;
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->status = ACTIVE;
dl_harq->first_rx = 1;
dl_harq->DCINdi = ndi;
}
else if (dl_harq->ack)
dl_harq->status = SCH_IDLE;
break;
case 3:
dl_harq->round = 3;
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->status = ACTIVE;
dl_harq->first_rx = 1;
dl_harq->DCINdi = ndi;
}
else if (dl_harq->ack)
dl_harq->status = SCH_IDLE;
break;
default:
AssertFatal(1==0,"Invalid value for rv %d\n",rv);
}
} }
else {
dl_harq->round++;
if (dl_harq->ack) dl_harq->status = SCH_IDLE;
LOG_D(PHY, "[HARQ-DL-PDSCH harqId : %d] reception of a retransmission \n", harq_pid);
}
} }
...@@ -120,7 +120,7 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq); ...@@ -120,7 +120,7 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq);
@param rnti_type type of rnti @param rnti_type type of rnti
@returns retransmission or new transmission */ @returns retransmission or new transmission */
void downlink_harq_process(NR_DL_UE_HARQ_t *dlsch, int harq_pid, int ndi, uint8_t rnti_type); void downlink_harq_process(NR_DL_UE_HARQ_t *dlsch, int harq_pid, int ndi, int rv, uint8_t rnti_type);
#undef EXTERN #undef EXTERN
#undef INIT_VARIABLES_HARQ_NR_H #undef INIT_VARIABLES_HARQ_NR_H
......
...@@ -114,7 +114,6 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind, ...@@ -114,7 +114,6 @@ void nr_fill_dl_indication(nr_downlink_indication_t *dl_ind,
dl_ind->dci_ind = NULL; dl_ind->dci_ind = NULL;
} }
} }
void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
...@@ -482,7 +481,8 @@ unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb ...@@ -482,7 +481,8 @@ unsigned int nr_get_tx_amp(int power_dBm, int power_max_dBm, int N_RB_UL, int nb
int nr_ue_pdcch_procedures(uint8_t gNB_id, int nr_ue_pdcch_procedures(uint8_t gNB_id,
PHY_VARS_NR_UE *ue, PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc) UE_nr_rxtx_proc_t *proc,
int n_ss)
{ {
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx; int nr_slot_rx = proc->nr_slot_rx;
...@@ -490,6 +490,9 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, ...@@ -490,6 +490,9 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
fapi_nr_dci_indication_t dci_ind = {0}; fapi_nr_dci_indication_t dci_ind = {0};
nr_downlink_indication_t dl_indication; nr_downlink_indication_t dl_indication;
NR_UE_PDCCH *pdcch_vars = ue->pdcch_vars[proc->thread_id][gNB_id];
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &pdcch_vars->pdcch_config[n_ss];
/* /*
// unsigned int dci_cnt=0, i; //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active // unsigned int dci_cnt=0, i; //removed for nr_ue_pdcch_procedures and added in the loop for nb_coreset_active
#ifdef NR_PDCCH_SCHED_DEBUG #ifdef NR_PDCCH_SCHED_DEBUG
...@@ -674,18 +677,18 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id, ...@@ -674,18 +677,18 @@ int nr_ue_pdcch_procedures(uint8_t gNB_id,
*/ */
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN);
nr_rx_pdcch(ue, proc); nr_rx_pdcch(ue, proc, rel15);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_IN);
#ifdef NR_PDCCH_SCHED_DEBUG #ifdef NR_PDCCH_SCHED_DEBUG
printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Entering function nr_dci_decoding_procedure with (nb_searchspace_active=%d)\n", printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Entering function nr_dci_decoding_procedure for search space %d)\n",
pdcch_vars->nb_search_space); n_ss);
#endif #endif
dci_cnt = nr_dci_decoding_procedure(ue, proc, &dci_ind); dci_cnt = nr_dci_decoding_procedure(ue, proc, &dci_ind, rel15);
#ifdef NR_PDCCH_SCHED_DEBUG #ifdef NR_PDCCH_SCHED_DEBUG
LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt); LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt);
...@@ -871,7 +874,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_ ...@@ -871,7 +874,7 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_
return 0; return 0;
} }
void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc, UE_nr_rxtx_proc_t *proc,
int gNB_id, int gNB_id,
PDSCH_t pdsch, PDSCH_t pdsch,
...@@ -882,7 +885,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -882,7 +885,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
if (dlsch0==NULL) if (dlsch0==NULL)
AssertFatal(0,"dlsch0 should be defined at this level \n"); AssertFatal(0,"dlsch0 should be defined at this level \n");
bool dec = false;
int harq_pid = dlsch0->current_harq_pid; int harq_pid = dlsch0->current_harq_pid;
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx; int nr_slot_rx = proc->nr_slot_rx;
...@@ -936,11 +939,11 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -936,11 +939,11 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
case PDSCH1: case PDSCH1:
LOG_E(PHY,"Illegal PDSCH %d for ue_pdsch_procedures\n",pdsch); LOG_E(PHY,"Illegal PDSCH %d for ue_pdsch_procedures\n",pdsch);
pdsch_vars = NULL; pdsch_vars = NULL;
return; return false;
break; break;
default: default:
pdsch_vars = NULL; pdsch_vars = NULL;
return; return false;
break; break;
} }
...@@ -953,13 +956,13 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -953,13 +956,13 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
else { else {
LOG_E(PHY,"[UE %d] Frame %d, nr_slot_rx %d: FATAL, prach_resources is NULL\n", ue->Mod_id, frame_rx, nr_slot_rx); LOG_E(PHY,"[UE %d] Frame %d, nr_slot_rx %d: FATAL, prach_resources is NULL\n", ue->Mod_id, frame_rx, nr_slot_rx);
//mac_xface->macphy_exit("prach_resources is NULL"); //mac_xface->macphy_exit("prach_resources is NULL");
return; return false;
} }
} }
// exit dlsch procedures as there are no active dlsch // exit dlsch procedures as there are no active dlsch
if (is_cw0_active != ACTIVE && is_cw1_active != ACTIVE) if (is_cw0_active != ACTIVE && is_cw1_active != ACTIVE)
return; return false;
// start ldpc decode for CW 0 // start ldpc decode for CW 0
dlsch0->harq_processes[harq_pid]->G = nr_get_G(dlsch0->harq_processes[harq_pid]->nb_rb, dlsch0->harq_processes[harq_pid]->G = nr_get_G(dlsch0->harq_processes[harq_pid]->nb_rb,
...@@ -1031,6 +1034,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -1031,6 +1034,8 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
LOG_T(PHY,"Sequential dlsch decoding , ret = %d\n", ret); LOG_T(PHY,"Sequential dlsch decoding , ret = %d\n", ret);
} }
if(ret<dlsch0->max_ldpc_iterations+1)
dec = true;
switch (pdsch) { switch (pdsch) {
case RA_PDSCH: case RA_PDSCH:
...@@ -1116,7 +1121,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -1116,7 +1121,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
nr_slot_rx, nr_slot_rx,
harq_pid, harq_pid,
pdsch==PDSCH?1:0, pdsch==PDSCH?1:0,
dlsch1->harq_processes[harq_pid]->TBS>256?1:0); dlsch1->harq_processes[harq_pid]->TBS>256?1:0);
LOG_T(PHY,"CW dlsch decoding is parallelized, ret1 = %d\n", ret1); LOG_T(PHY,"CW dlsch decoding is parallelized, ret1 = %d\n", ret1);
} }
else { else {
...@@ -1154,7 +1159,6 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -1154,7 +1159,6 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
LOG_D(PHY,"AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n", LOG_D(PHY,"AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0)); frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS); LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS);
} }
...@@ -1298,6 +1302,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, ...@@ -1298,6 +1302,7 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
} }
} }
} }
return dec;
} }
...@@ -1747,6 +1752,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1747,6 +1752,7 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
LOG_D(PHY," ------ --> PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx); LOG_D(PHY," ------ --> PDCCH ChannelComp/LLR Frame.slot %d.%d ------ \n", frame_rx%1024, nr_slot_rx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_IN);
for (uint16_t l=0; l<nb_symb_pdcch; l++) { for (uint16_t l=0; l<nb_symb_pdcch; l++) {
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
...@@ -1756,29 +1762,30 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue, ...@@ -1756,29 +1762,30 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
proc, proc,
l, l,
nr_slot_rx); nr_slot_rx);
}
dci_cnt = 0; dci_cnt = 0;
for(int n_ss = 0; n_ss<pdcch_vars->nb_search_space; n_ss++) { for(int n_ss = 0; n_ss<pdcch_vars->nb_search_space; n_ss++) {
for (uint16_t l=0; l<nb_symb_pdcch; l++) {
// note: this only works if RBs for PDCCH are contigous! // note: this only works if RBs for PDCCH are contigous!
LOG_D(PHY, "pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n", LOG_D(PHY, "pdcch_channel_estimation: first_carrier_offset %d, BWPStart %d, coreset_start_rb %d\n",
fp->first_carrier_offset, pdcch_vars->pdcch_config[n_ss].BWPStart, coreset_start_rb); fp->first_carrier_offset, pdcch_vars->pdcch_config[n_ss].BWPStart, coreset_start_rb);
if (coreset_nb_rb > 0) if (coreset_nb_rb > 0)
nr_pdcch_channel_estimation(ue, nr_pdcch_channel_estimation(ue,
proc, proc,
gNB_id, gNB_id,
nr_slot_rx, nr_slot_rx,
l, l,
fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12, fp->first_carrier_offset+(pdcch_vars->pdcch_config[n_ss].BWPStart + coreset_start_rb)*12,
coreset_nb_rb); coreset_nb_rb);
#if UE_TIMING_TRACE #if UE_TIMING_TRACE
stop_meas(&ue->ofdm_demod_stats); stop_meas(&ue->ofdm_demod_stats);
#endif #endif
dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc);
} }
dci_cnt = dci_cnt + nr_ue_pdcch_procedures(gNB_id, ue, proc, n_ss);
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP_PDCCH, VCD_FUNCTION_OUT);
......
...@@ -267,6 +267,8 @@ void nr_dlsim_preprocessor(module_id_t module_id, ...@@ -267,6 +267,8 @@ void nr_dlsim_preprocessor(module_id_t module_id,
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
ps->nrOfLayers = g_nrOfLayers;
nr_set_pdsch_semi_static(scc, nr_set_pdsch_semi_static(scc,
UE_info->CellGroup[0], UE_info->CellGroup[0],
sched_ctrl->active_bwp, sched_ctrl->active_bwp,
...@@ -282,7 +284,6 @@ void nr_dlsim_preprocessor(module_id_t module_id, ...@@ -282,7 +284,6 @@ void nr_dlsim_preprocessor(module_id_t module_id,
* configuration */ * configuration */
ps->mcsTableIdx = g_mcsTableIdx; ps->mcsTableIdx = g_mcsTableIdx;
sched_pdsch->nrOfLayers = g_nrOfLayers;
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx);
sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm, sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm,
...@@ -292,7 +293,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, ...@@ -292,7 +293,7 @@ void nr_dlsim_preprocessor(module_id_t module_id,
ps->N_PRB_DMRS * ps->N_DMRS_SLOT, ps->N_PRB_DMRS * ps->N_DMRS_SLOT,
0 /* N_PRB_oh, 0 for initialBWP */, 0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */, 0 /* tb_scaling */,
sched_pdsch->nrOfLayers) ps->nrOfLayers)
>> 3; >> 3;
/* the simulator assumes the HARQ PID is equal to the slot number */ /* the simulator assumes the HARQ PID is equal to the slot number */
...@@ -779,9 +780,9 @@ int main(int argc, char **argv) ...@@ -779,9 +780,9 @@ int main(int argc, char **argv)
AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface");
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
// common configuration // common configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 0, 0, NULL); rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 0, 0, NULL);
// UE dedicated configuration // UE dedicated configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
// reset preprocessor to the one of DLSIM after it has been set during // reset preprocessor to the one of DLSIM after it has been set during
// rrc_mac_config_req_gNB // rrc_mac_config_req_gNB
gNB_mac->pre_processor_dl = nr_dlsim_preprocessor; gNB_mac->pre_processor_dl = nr_dlsim_preprocessor;
...@@ -934,6 +935,7 @@ int main(int argc, char **argv) ...@@ -934,6 +935,7 @@ int main(int argc, char **argv)
//Configure UE //Configure UE
rrc.carrier.MIB = (uint8_t*) malloc(4); rrc.carrier.MIB = (uint8_t*) malloc(4);
rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0); rrc.carrier.sizeof_MIB = do_MIB_NR(&rrc,0);
nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib, NULL, NULL, secondaryCellGroup); nr_rrc_mac_config_req_ue(0,0,0,rrc.carrier.mib.message.choice.mib, NULL, NULL, secondaryCellGroup);
...@@ -1009,9 +1011,10 @@ int main(int argc, char **argv) ...@@ -1009,9 +1011,10 @@ int main(int argc, char **argv)
UE_harq_process->ack = 0; UE_harq_process->ack = 0;
round = 0; round = 0;
UE_harq_process->round = round; UE_harq_process->round = round;
UE_harq_process->first_tx = 1; UE_harq_process->first_rx = 1;
while ((round<num_rounds) && (UE_harq_process->ack==0)) { while ((round<num_rounds) && (UE_harq_process->ack==0)) {
memset(RC.nrmac[0]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int)); memset(RC.nrmac[0]->cce_list[1][0],0,MAX_NUM_CCE*sizeof(int));
memset(RC.nrmac[0]->cce_list[1][1],0,MAX_NUM_CCE*sizeof(int)); memset(RC.nrmac[0]->cce_list[1][1],0,MAX_NUM_CCE*sizeof(int));
clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot); clear_nr_nfapi_information(RC.nrmac[0], 0, frame, slot);
......
...@@ -70,6 +70,31 @@ softmodem_params_t *get_softmodem_params(void) {return 0;} ...@@ -70,6 +70,31 @@ softmodem_params_t *get_softmodem_params(void) {return 0;}
void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {}
int nr_ue_pdcch_procedures(uint8_t gNB_id,
PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int n_ss) {
return 0;
}
int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int eNB_id, PDSCH_t pdsch,
NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1) {
return 0;
}
bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
UE_nr_rxtx_proc_t *proc,
int gNB_id,
PDSCH_t pdsch,
NR_UE_DLSCH_t *dlsch0,
NR_UE_DLSCH_t *dlsch1,
int *dlsch_errors,
uint8_t dlsch_parallel) {
return false;
}
void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
int N_RB_DL, int N_RB_DL,
int N_RB_UL, int N_RB_UL,
...@@ -686,7 +711,7 @@ int main(int argc, char **argv) ...@@ -686,7 +711,7 @@ int main(int argc, char **argv)
} }
if (UE->is_synchronized == 0) { if (UE->is_synchronized == 0) {
UE_nr_rxtx_proc_t proc={0}; UE_nr_rxtx_proc_t proc={0};
ret = nr_initial_sync(&proc, UE, 1); ret = nr_initial_sync(&proc, UE, 1, 0, 0);
printf("nr_initial_sync1 returns %d\n",ret); printf("nr_initial_sync1 returns %d\n",ret);
if (ret<0) n_errors++; if (ret<0) n_errors++;
} }
......
...@@ -67,6 +67,7 @@ extern uint16_t prach_root_sequence_map0_3[838]; ...@@ -67,6 +67,7 @@ extern uint16_t prach_root_sequence_map0_3[838];
openair0_config_t openair0_cfg[MAX_CARDS]; openair0_config_t openair0_cfg[MAX_CARDS];
//uint8_t nfapi_mode=0; //uint8_t nfapi_mode=0;
uint64_t downlink_frequency[MAX_NUM_CCs][4]; uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
uint16_t sl_ahead = 0; uint16_t sl_ahead = 0;
msc_interface_t msc_interface; msc_interface_t msc_interface;
uint32_t N_RB_DL = 106; uint32_t N_RB_DL = 106;
......
...@@ -723,9 +723,9 @@ int main(int argc, char **argv) ...@@ -723,9 +723,9 @@ int main(int argc, char **argv)
gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; gNB->if_inst->NR_PHY_config_req = nr_phy_config_request;
// common configuration // common configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 0, 0, NULL); rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 0, 0, NULL);
// UE dedicated configuration // UE dedicated configuration
rrc_mac_config_req_gNB(0,0, n_tx, n_tx, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup); rrc_mac_config_req_gNB(0,0, n_tx, n_tx, 0, scc, 1, secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity,secondaryCellGroup);
phy_init_nr_gNB(gNB,0,1); phy_init_nr_gNB(gNB,0,1);
N_RB_DL = gNB->frame_parms.N_RB_DL; N_RB_DL = gNB->frame_parms.N_RB_DL;
......
...@@ -409,6 +409,7 @@ typedef struct NRRrcConfigurationReq_s { ...@@ -409,6 +409,7 @@ typedef struct NRRrcConfigurationReq_s {
NR_ServingCellConfigCommon_t *scc; NR_ServingCellConfigCommon_t *scc;
NR_ServingCellConfig_t *scd; NR_ServingCellConfig_t *scd;
int ssb_SubcarrierOffset; int ssb_SubcarrierOffset;
int sib1_tda;
int pdsch_AntennaPorts; int pdsch_AntennaPorts;
int pusch_AntennaPorts; int pusch_AntennaPorts;
int do_CSIRS; int do_CSIRS;
......
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
#include "openair1/PHY/INIT/phy_init.h" #include "openair1/PHY/INIT/phy_init.h"
extern unsigned char NB_eNB_INST; extern unsigned char NB_eNB_INST;
#include <nr-softmodem.h>
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
# define ENB_REGISTER_RETRY_DELAY 10 # define ENB_REGISTER_RETRY_DELAY 10
......
...@@ -1017,6 +1017,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { ...@@ -1017,6 +1017,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) {
NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).pdsch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_IDX].iptr;
printf("pusch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr); printf("pusch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr);
NRRRC_CONFIGURATION_REQ (msg_p).pusch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).pusch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr;
NRRRC_CONFIGURATION_REQ (msg_p).sib1_tda = *GNBParamList.paramarray[i][GNB_SIB1_TDA_IDX].iptr;
printf("Do CSI-RS %d\n",*GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr); printf("Do CSI-RS %d\n",*GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr);
NRRRC_CONFIGURATION_REQ (msg_p).do_CSIRS = *GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr; NRRRC_CONFIGURATION_REQ (msg_p).do_CSIRS = *GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr;
NRRRC_CONFIGURATION_REQ (msg_p).scc = scc; NRRRC_CONFIGURATION_REQ (msg_p).scc = scc;
...@@ -1896,6 +1897,7 @@ void configure_gnb_du_mac(int inst) { ...@@ -1896,6 +1897,7 @@ void configure_gnb_du_mac(int inst) {
rrc->configuration.ssb_SubcarrierOffset, rrc->configuration.ssb_SubcarrierOffset,
rrc->configuration.pdsch_AntennaPorts, rrc->configuration.pdsch_AntennaPorts,
rrc->configuration.pusch_AntennaPorts, rrc->configuration.pusch_AntennaPorts,
rrc->configuration.sib1_tda,
rrc->configuration.scc, rrc->configuration.scc,
0, 0,
0, // rnti 0, // rnti
......
...@@ -116,6 +116,7 @@ typedef enum { ...@@ -116,6 +116,7 @@ typedef enum {
#define GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET "ssb_SubcarrierOffset" #define GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET "ssb_SubcarrierOffset"
#define GNB_CONFIG_STRING_PDSCHANTENNAPORTS "pdsch_AntennaPorts" #define GNB_CONFIG_STRING_PDSCHANTENNAPORTS "pdsch_AntennaPorts"
#define GNB_CONFIG_STRING_PUSCHANTENNAPORTS "pusch_AntennaPorts" #define GNB_CONFIG_STRING_PUSCHANTENNAPORTS "pusch_AntennaPorts"
#define GNB_CONFIG_STRING_SIB1TDA "sib1_tda"
#define GNB_CONFIG_STRING_DOCSIRS "do_CSIRS" #define GNB_CONFIG_STRING_DOCSIRS "do_CSIRS"
#define GNB_CONFIG_STRING_NRCELLID "nr_cellid" #define GNB_CONFIG_STRING_NRCELLID "nr_cellid"
...@@ -141,8 +142,9 @@ typedef enum { ...@@ -141,8 +142,9 @@ typedef enum {
{GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0, iptr:NULL, defintval:31, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_SSBSUBCARRIEROFFSET, NULL, 0, iptr:NULL, defintval:31, TYPE_INT, 0}, \
{GNB_CONFIG_STRING_PDSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_PDSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \
{GNB_CONFIG_STRING_PUSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_PUSCHANTENNAPORTS, NULL, 0, iptr:NULL, defintval:1, TYPE_INT, 0}, \
{GNB_CONFIG_STRING_SIB1TDA, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \
{GNB_CONFIG_STRING_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \ {GNB_CONFIG_STRING_DOCSIRS, NULL, 0, iptr:NULL, defintval:0, TYPE_INT, 0}, \
{GNB_CONFIG_STRING_NRCELLID , NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \ {GNB_CONFIG_STRING_NRCELLID, NULL, 0, u64ptr:NULL, defint64val:1, TYPE_UINT64, 0}, \
} }
#define GNB_GNB_ID_IDX 0 #define GNB_GNB_ID_IDX 0
...@@ -162,8 +164,9 @@ typedef enum { ...@@ -162,8 +164,9 @@ typedef enum {
#define GNB_SSB_SUBCARRIEROFFSET_IDX 14 #define GNB_SSB_SUBCARRIEROFFSET_IDX 14
#define GNB_PDSCH_ANTENNAPORTS_IDX 15 #define GNB_PDSCH_ANTENNAPORTS_IDX 15
#define GNB_PUSCH_ANTENNAPORTS_IDX 16 #define GNB_PUSCH_ANTENNAPORTS_IDX 16
#define GNB_DO_CSIRS_IDX 17 #define GNB_SIB1_TDA_IDX 17
#define GNB_NRCELLID_IDX 18 #define GNB_DO_CSIRS_IDX 18
#define GNB_NRCELLID_IDX 19
#define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD}
#define GNBPARAMS_CHECK { \ #define GNBPARAMS_CHECK { \
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <string.h> #include <string.h>
#include <stdbool.h> #include <stdbool.h>
#include "NR_SubcarrierSpacing.h"
#define TABLE_38213_13_1_NUM_INDEXES 15 #define TABLE_38213_13_1_NUM_INDEXES 15
#define TABLE_38213_13_2_NUM_INDEXES 14 #define TABLE_38213_13_2_NUM_INDEXES 14
#define TABLE_38213_13_3_NUM_INDEXES 9 #define TABLE_38213_13_3_NUM_INDEXES 9
...@@ -452,9 +454,11 @@ typedef struct Type0_PDCCH_CSS_config_s { ...@@ -452,9 +454,11 @@ typedef struct Type0_PDCCH_CSS_config_s {
uint32_t number_of_search_space_per_slot; uint32_t number_of_search_space_per_slot;
uint32_t first_symbol_index; uint32_t first_symbol_index;
uint32_t search_space_duration; uint32_t search_space_duration;
uint32_t search_space_frame_period; // in slots
uint32_t ssb_length; uint32_t ssb_length;
uint32_t ssb_index; uint32_t ssb_index;
uint32_t cset_start_rb; uint32_t cset_start_rb;
NR_SubcarrierSpacing_t scs_pdcch;
bool active; bool active;
} NR_Type0_PDCCH_CSS_config_t; } NR_Type0_PDCCH_CSS_config_t;
......
...@@ -135,10 +135,21 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD ...@@ -135,10 +135,21 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD
NR_SubcarrierSpacing_t scs_ssb, NR_SubcarrierSpacing_t scs_ssb,
frequency_range_t frequency_range, frequency_range_t frequency_range,
uint32_t ssb_index, uint32_t ssb_index,
uint32_t ssb_period,
uint32_t ssb_offset_point_a); uint32_t ssb_offset_point_a);
uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb); uint16_t get_ssb_start_symbol(const long band, NR_SubcarrierSpacing_t scs, int i_ssb);
void get_info_from_tda_tables(int default_abc,
int tda,
int dmrs_TypeA_Position,
int normal_CP,
int *startSymbolIndex,
int *nrOfSymbols);
void fill_coresetZero(NR_ControlResourceSet_t *coreset0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config);
uint8_t fill_searchSpaceZero(NR_SearchSpace_t *ss0, NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, int L);
uint16_t compute_pucch_prb_size(uint8_t format, uint16_t compute_pucch_prb_size(uint8_t format,
uint8_t nr_prbs, uint8_t nr_prbs,
uint16_t O_tot, uint16_t O_tot,
......
...@@ -138,13 +138,4 @@ extern const float table_38213_13_12_c3[16]; ...@@ -138,13 +138,4 @@ extern const float table_38213_13_12_c3[16];
extern const int32_t table_38213_10_1_1_c2[5]; extern const int32_t table_38213_10_1_1_c2[5];
extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos2[16][3];
extern const uint8_t table_5_1_2_1_1_2_time_dom_res_alloc_A_dmrs_typeA_pos3[16][3];
extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos2[16][3];
extern const uint8_t table_5_1_2_1_1_3_time_dom_res_alloc_A_extCP_dmrs_typeA_pos3[16][3];
extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos2[16][3];
extern const uint8_t table_5_1_2_1_1_4_time_dom_res_alloc_B_dmrs_typeA_pos3[16][3];
extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos2[16][3];
extern const uint8_t table_5_1_2_1_1_5_time_dom_res_alloc_C_dmrs_typeA_pos3[16][3];
#endif //DEF_H #endif //DEF_H
This diff is collapsed.
...@@ -300,6 +300,8 @@ typedef struct { ...@@ -300,6 +300,8 @@ typedef struct {
/// BeamfailurerecoveryConfig /// BeamfailurerecoveryConfig
NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig; NR_BeamFailureRecoveryConfig_t RA_BeamFailureRecoveryConfig;
/// RA SearchSpace
NR_SearchSpace_t *ss;
} RA_config_t; } RA_config_t;
typedef struct { typedef struct {
...@@ -422,6 +424,8 @@ typedef struct { ...@@ -422,6 +424,8 @@ typedef struct {
NR_SearchSpace_t *search_space_zero; NR_SearchSpace_t *search_space_zero;
NR_ControlResourceSet_t *coreset0; NR_ControlResourceSet_t *coreset0;
frequency_range_t frequency_range; frequency_range_t frequency_range;
uint16_t nr_band;
uint8_t ssb_subcarrier_offset;
dci_pdu_rel15_t def_dci_pdu_rel15[8]; dci_pdu_rel15_t def_dci_pdu_rel15[8];
......
...@@ -189,8 +189,10 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac, ...@@ -189,8 +189,10 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu, nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu,
fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu, fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu,
uint8_t time_domain_ind, uint8_t time_domain_ind,
int default_abc,
bool use_default); bool use_default);
uint8_t nr_ue_get_sdu(module_id_t module_idP, uint8_t nr_ue_get_sdu(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t subframe, sub_frame_t subframe,
...@@ -296,6 +298,15 @@ void nr_ue_msg3_scheduler(NR_UE_MAC_INST_t *mac, ...@@ -296,6 +298,15 @@ void nr_ue_msg3_scheduler(NR_UE_MAC_INST_t *mac,
sub_frame_t current_slot, sub_frame_t current_slot,
uint8_t Msg3_tda_id); uint8_t Msg3_tda_id);
void nr_ue_sib1_scheduler(module_id_t module_idP,
int cc_id,
uint16_t ssb_start_symbol,
uint16_t frame,
uint8_t ssb_subcarrier_offset,
uint32_t ssb_index,
uint16_t ssb_start_subcarrier,
frequency_range_t frequency_range);
/* \brief Function called by PHY to process the received RAR and check that the preamble matches what was sent by the gNB. It provides the timing advance and t-CRNTI. /* \brief Function called by PHY to process the received RAR and check that the preamble matches what was sent by the gNB. It provides the timing advance and t-CRNTI.
@param Mod_id Index of UE instance @param Mod_id Index of UE instance
@param CC_id Index to a component carrier @param CC_id Index to a component carrier
...@@ -362,6 +373,9 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p ...@@ -362,6 +373,9 @@ int8_t nr_ue_process_dci_freq_dom_resource_assignment(nfapi_nr_ue_pusch_pdu_t *p
uint16_t n_RB_DLBWP, uint16_t n_RB_DLBWP,
uint16_t riv); uint16_t riv);
void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id);
void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15);
void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu, void get_num_re_dmrs(nfapi_nr_ue_pusch_pdu_t *pusch_pdu,
uint8_t *nb_dmrs_re_per_rb, uint8_t *nb_dmrs_re_per_rb,
uint16_t *number_dmrs_symbols); uint16_t *number_dmrs_symbols);
......
...@@ -43,36 +43,27 @@ ...@@ -43,36 +43,27 @@
static NR_UE_MAC_INST_t *nr_ue_mac_inst; static NR_UE_MAC_INST_t *nr_ue_mac_inst;
NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) {
{
//LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n"); //LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
//LOG_I(MAC, "[MAIN] init UE MAC functions \n"); //LOG_I(MAC, "[MAIN] init UE MAC functions \n");
//init mac here //init mac here
nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST); nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(sizeof(NR_UE_MAC_INST_t),NB_NR_UE_MAC_INST);
for (int j=0;j<NB_NR_UE_MAC_INST;j++) for (int j=0;j<NB_NR_UE_MAC_INST;j++)
for (int i=0;i<NR_MAX_HARQ_PROCESSES;i++) for (int i=0;i<NR_MAX_HARQ_PROCESSES;i++) nr_ue_mac_inst[j].first_ul_tx[i]=1;
nr_ue_mac_inst[j].first_ul_tx[i]=1;
if (rrc_inst && (rrc_inst->scell_group_config || rrc_inst->cell_group_config)) {
if(rrc_inst->scell_group_config) { if (rrc_inst && rrc_inst->scell_group_config) {
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,rrc_inst->scell_group_config);
//if (IS_SOFTMODEM_NOS1){
// AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
// nr_pdcp_layer_init();
// nr_DRB_preconfiguration(nr_ue_mac_inst->crnti);
//}
} else if (rrc_inst->cell_group_config) {
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,rrc_inst->cell_group_config,NULL);
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
if (IS_SOFTMODEM_NOS1){
pdcp_layer_init();
nr_DRB_preconfiguration(nr_ue_mac_inst->crnti);
}
}
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,rrc_inst->scell_group_config);
AssertFatal(rlc_module_init(0) == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__);
if (IS_SOFTMODEM_NOS1){
pdcp_layer_init();
nr_DRB_preconfiguration(nr_ue_mac_inst->crnti);
}
// Allocate memory for ul_config_request in the mac instance. This is now a pointer and will // Allocate memory for ul_config_request in the mac instance. This is now a pointer and will
// point to a list of structures (one for each UL slot) to store PUSCH scheduling parameters // point to a list of structures (one for each UL slot) to store PUSCH scheduling parameters
// received from UL DCI. // received from UL DCI.
...@@ -83,8 +74,8 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst) ...@@ -83,8 +74,8 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(NR_UE_RRC_INST_t* rrc_inst)
LOG_D(MAC, "Initializing ul_config_request. num_slots_ul = %d\n", num_slots_ul); LOG_D(MAC, "Initializing ul_config_request. num_slots_ul = %d\n", num_slots_ul);
nr_ue_mac_inst->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t)); nr_ue_mac_inst->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t));
} }
}
} else { else {
LOG_I(MAC,"Running without CellGroupConfig\n"); LOG_I(MAC,"Running without CellGroupConfig\n");
nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,NULL); nr_rrc_mac_config_req_ue(0,0,0,NULL,NULL,NULL,NULL);
if(get_softmodem_params()->sa == 1) { if(get_softmodem_params()->sa == 1) {
......
...@@ -81,6 +81,41 @@ void init_RA(module_id_t mod_id, ...@@ -81,6 +81,41 @@ void init_RA(module_id_t mod_id,
prach_resources->POWER_OFFSET_2STEP_RA = 0; prach_resources->POWER_OFFSET_2STEP_RA = 0;
prach_resources->RA_SCALING_FACTOR_BI = 1; prach_resources->RA_SCALING_FACTOR_BI = 1;
struct NR_PDCCH_ConfigCommon__commonSearchSpaceList *commonSearchSpaceList;
NR_SearchSpaceId_t *ra_ss;
NR_SearchSpaceId_t ss_id = -1;
NR_SearchSpace_t *ss = NULL;
if(mac->scc_SIB) {
commonSearchSpaceList = mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
ss_id = *mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
}
else{
if (mac->scc) {
NR_SearchSpaceId_t *ra_ss = mac->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
if (ra_ss) {
commonSearchSpaceList = mac->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
ss_id = *mac->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
}
}
if (ss_id < 0) {
ra_ss = mac->DLbwp[0]->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
if (ra_ss) {
commonSearchSpaceList = mac->DLbwp[0]->bwp_Common->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList;
ss_id = *mac->DLbwp[0]->bwp_Common->pdcch_ConfigCommon->choice.setup->ra_SearchSpace;
}
}
}
AssertFatal(ss_id>-1,"Didn't find ra-SearchSpace\n");
AssertFatal(commonSearchSpaceList->list.count > 0, "common SearchSpace list has 0 elements\n");
// Common searchspace list
for (int i = 0; i < commonSearchSpaceList->list.count; i++) {
ss = commonSearchSpaceList->list.array[i];
if (ss->searchSpaceId == ss_id)
ra->ss = ss;
}
if (rach_ConfigDedicated) { if (rach_ConfigDedicated) {
if (rach_ConfigDedicated->cfra){ if (rach_ConfigDedicated->cfra){
LOG_I(MAC, "Initialization of 2-step contention-free random access procedure\n"); LOG_I(MAC, "Initialization of 2-step contention-free random access procedure\n");
......
...@@ -66,7 +66,6 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd ...@@ -66,7 +66,6 @@ void fill_dci_search_candidates(NR_SearchSpace_t *ss,fapi_nr_dl_config_dci_dl_pd
void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id){ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15, fapi_nr_dl_config_request_t *dl_config, int rnti_type, int ss_id){
RA_config_t *ra = &mac->ra;
uint16_t monitoringSymbolsWithinSlot = 0; uint16_t monitoringSymbolsWithinSlot = 0;
uint8_t coreset_id = 1; uint8_t coreset_id = 1;
int sps = 0; int sps = 0;
...@@ -90,6 +89,9 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t ...@@ -90,6 +89,9 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
NR_SearchSpace_t *ss; NR_SearchSpace_t *ss;
NR_ControlResourceSet_t *coreset; NR_ControlResourceSet_t *coreset;
if(ss_id>=0) { if(ss_id>=0) {
AssertFatal(mac->scc != NULL, "scc is null\n");
initialDownlinkBWP = scc->downlinkConfigCommon->initialDownlinkBWP;
bwp_Common = mac->DLbwp[bwp_id - 1]->bwp_Common;
ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id]; ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id];
coreset = mac->coreset[bwp_id - 1][coreset_id - 1]; coreset = mac->coreset[bwp_id - 1][coreset_id - 1];
rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG; rel15->coreset.CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG;
...@@ -107,7 +109,8 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t ...@@ -107,7 +109,8 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
for (int i = 0; i < 6; i++) for (int i = 0; i < 6; i++)
rel15->coreset.frequency_domain_resource[i] = coreset->frequencyDomainResources.buf[i]; rel15->coreset.frequency_domain_resource[i] = coreset->frequencyDomainResources.buf[i];
rel15->coreset.CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved ? FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED; rel15->coreset.CceRegMappingType = coreset->cce_REG_MappingType.present ==
NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved ? FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED : FAPI_NR_CCE_REG_MAPPING_TYPE_NON_INTERLEAVED;
if (rel15->coreset.CceRegMappingType == FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED) { if (rel15->coreset.CceRegMappingType == FAPI_NR_CCE_REG_MAPPING_TYPE_INTERLEAVED) {
struct NR_ControlResourceSet__cce_REG_MappingType__interleaved *interleaved = coreset->cce_REG_MappingType.choice.interleaved; struct NR_ControlResourceSet__cce_REG_MappingType__interleaved *interleaved = coreset->cce_REG_MappingType.choice.interleaved;
rel15->coreset.RegBundleSize = (interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2 + interleaved->reg_BundleSize); rel15->coreset.RegBundleSize = (interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2 + interleaved->reg_BundleSize);
...@@ -130,10 +133,6 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t ...@@ -130,10 +133,6 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
rel15->coreset.scrambling_rnti = 0; rel15->coreset.scrambling_rnti = 0;
} }
#ifdef DEBUG_DCI
LOG_D(MAC, "[DCI_CONFIG] Configure DCI PDU: ss_id %d bwp %p bwp_Id %d controlResourceSetId %d\n", ss_id, mac->DLbwp[bwp_id - 1], mac->DLbwp[bwp_id - 1]->bwp_Id, coreset->controlResourceSetId);
#endif
// loop over RNTI type and configure resource allocation for DCI // loop over RNTI type and configure resource allocation for DCI
switch(rnti_type) { switch(rnti_type) {
case NR_RNTI_C: case NR_RNTI_C:
...@@ -161,7 +160,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t ...@@ -161,7 +160,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
// we use the initial DL BWP // we use the initial DL BWP
sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12; sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12;
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = ra->ra_rnti; rel15->rnti = mac->ra.ra_rnti;
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
if (get_softmodem_params()->sa) { if (get_softmodem_params()->sa) {
rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
...@@ -179,7 +178,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t ...@@ -179,7 +178,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
// we use the initial DL BWP // we use the initial DL BWP
sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12; sps = initialDownlinkBWP->genericParameters.cyclicPrefix == NULL ? 14 : 12;
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
rel15->rnti = ra->t_crnti; rel15->rnti = mac->ra.t_crnti;
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing; rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
...@@ -199,7 +198,11 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t ...@@ -199,7 +198,11 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values
rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs; rel15->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs;
rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb; rel15->BWPStart = mac->type0_PDCCH_CSS_config.cset_start_rb;
rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
if(mac->frequency_range == FR1)
rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon;
else
rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2;
for (int i = 0; i < rel15->num_dci_options; i++) { for (int i = 0; i < rel15->num_dci_options; i++) {
rel15->dci_length_options[i] = nr_dci_size(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0); rel15->dci_length_options[i] = nr_dci_size(initialUplinkBWP, mac->cg, &mac->def_dci_pdu_rel15[rel15->dci_format_options[i]], rel15->dci_format_options[i], NR_RNTI_SI, rel15->BWPSize, 0);
...@@ -428,11 +431,13 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl ...@@ -428,11 +431,13 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
} }
else { // use coreset0/ss0 else { // use coreset0/ss0
NR_SearchSpace_t *ss0 = mac->search_space_zero; NR_SearchSpace_t *ss0 = mac->search_space_zero;
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15; if(ss0) {
rel15->num_dci_options = 1; fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15;
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0; rel15->num_dci_options = 1;
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C , -1); rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
fill_dci_search_candidates(ss0, rel15); config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C , -1);
dl_config->number_pdus = 1; fill_dci_search_candidates(ss0, rel15);
dl_config->number_pdus = 1;
}
} }
} }
This diff is collapsed.
...@@ -419,6 +419,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -419,6 +419,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
int ssb_SubcarrierOffset, int ssb_SubcarrierOffset,
int pdsch_AntennaPorts, int pdsch_AntennaPorts,
int pusch_AntennaPorts, int pusch_AntennaPorts,
int sib1_tda,
NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfigCommon_t *scc,
int add_ue, int add_ue,
uint32_t rnti, uint32_t rnti,
...@@ -507,6 +508,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -507,6 +508,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
if (get_softmodem_params()->sa > 0) { if (get_softmodem_params()->sa > 0) {
NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[0]; NR_COMMON_channels_t *cc = &RC.nrmac[Mod_idP]->common_channels[0];
RC.nrmac[Mod_idP]->sib1_tda = sib1_tda;
for (int n=0;n<NR_NB_RA_PROC_MAX;n++ ) { for (int n=0;n<NR_NB_RA_PROC_MAX;n++ ) {
cc->ra[n].cfra = false; cc->ra[n].cfra = false;
cc->ra[n].rnti = 0; cc->ra[n].rnti = 0;
......
...@@ -786,12 +786,18 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t ...@@ -786,12 +786,18 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
NR_BWP_Downlink_t *bwp = NULL; NR_BWP_Downlink_t *bwp = NULL;
NR_ControlResourceSet_t *coreset = NULL; NR_ControlResourceSet_t *coreset = NULL;
NR_BWP_t *genericParameters = NULL;
if (ra->CellGroup && if (ra->CellGroup &&
ra->CellGroup->spCellConfig && ra->CellGroup->spCellConfig &&
ra->CellGroup->spCellConfig->spCellConfigDedicated && ra->CellGroup->spCellConfig->spCellConfigDedicated &&
ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList && ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList &&
ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]) ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]) {
bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1]; bwp = ra->CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[ra->bwp_id-1];
genericParameters = &bwp->bwp_Common->genericParameters;
}
else {
genericParameters= &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
}
if (*ss->controlResourceSetId == 0) if (*ss->controlResourceSetId == 0)
coreset = nr_mac->sched_ctrlCommon->coreset; // this is coreset 0 coreset = nr_mac->sched_ctrlCommon->coreset; // this is coreset 0
...@@ -810,7 +816,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t ...@@ -810,7 +816,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu)); ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
pdcch_pdu_rel15 = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15; pdcch_pdu_rel15 = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15;
ul_dci_req->numPdus += 1; ul_dci_req->numPdus += 1;
nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp); nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, genericParameters, NULL);
nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15; nr_mac->pdcch_pdu_idx[CC_id][ra->bwp_id][coresetid] = pdcch_pdu_rel15;
} }
...@@ -1211,7 +1217,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1211,7 +1217,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu)); dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu));
dl_req->nPDUs += 1; dl_req->nPDUs += 1;
pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp); nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, genericParameters, NULL);
nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15; nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15;
} }
...@@ -1421,11 +1427,15 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1421,11 +1427,15 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
long BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); long BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
long BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); long BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
/* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */
int current_harq_pid = sched_ctrl->retrans_dl_harq.head;
// HARQ management // HARQ management
AssertFatal(sched_ctrl->available_dl_harq.head >= 0, if (current_harq_pid < 0) {
"UE context not initialized: no HARQ processes found\n"); AssertFatal(sched_ctrl->available_dl_harq.head >= 0,
int current_harq_pid = sched_ctrl->available_dl_harq.head; "UE context not initialized: no HARQ processes found\n");
remove_front_nr_list(&sched_ctrl->available_dl_harq); current_harq_pid = sched_ctrl->available_dl_harq.head;
remove_front_nr_list(&sched_ctrl->available_dl_harq);
}
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid]; NR_UE_harq_t *harq = &sched_ctrl->harq_processes[current_harq_pid];
DevAssert(!harq->is_waiting); DevAssert(!harq->is_waiting);
add_tail_nr_list(&sched_ctrl->feedback_dl_harq, current_harq_pid); add_tail_nr_list(&sched_ctrl->feedback_dl_harq, current_harq_pid);
...@@ -1458,18 +1468,19 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1458,18 +1468,19 @@ 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_slot = pucch->ul_slot;
harq->feedback_frame = pucch->frame; harq->feedback_frame = pucch->frame;
// Bytes to be transmitted
uint8_t *buf = (uint8_t *) harq->tb; uint8_t *buf = (uint8_t *) harq->tb;
uint16_t mac_pdu_length = nr_write_ce_dlsch_pdu(module_idP, nr_mac->sched_ctrlCommon, buf, 255, ra->cont_res_id); // Bytes to be transmitted
LOG_D(NR_MAC,"Encoded contention resolution mac_pdu_length %d\n",mac_pdu_length); if (harq->round == 0) {
uint16_t mac_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, CCCH, ra->rnti, 1, &buf[mac_pdu_length+2]); uint16_t mac_pdu_length = nr_write_ce_dlsch_pdu(module_idP, nr_mac->sched_ctrlCommon, buf, 255, ra->cont_res_id);
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->R = 0; LOG_D(NR_MAC,"Encoded contention resolution mac_pdu_length %d\n",mac_pdu_length);
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->F = 0; uint16_t mac_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, CCCH, ra->rnti, 1, &buf[mac_pdu_length+2]);
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->LCID = DL_SCH_LCID_CCCH; ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->R = 0;
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->L = mac_sdu_length; ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->F = 0;
mac_pdu_length = mac_pdu_length + mac_sdu_length + sizeof(NR_MAC_SUBHEADER_SHORT); ((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->LCID = DL_SCH_LCID_CCCH;
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->L = mac_sdu_length;
LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + %d bytes), mac_pdu_length %d\n", mac_sdu_length, (int)sizeof(NR_MAC_SUBHEADER_SHORT), mac_pdu_length); ra->mac_pdu_length = mac_pdu_length + mac_sdu_length + sizeof(NR_MAC_SUBHEADER_SHORT);
LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + %d bytes), mac_pdu_length %d\n", mac_sdu_length, (int)sizeof(NR_MAC_SUBHEADER_SHORT), ra->mac_pdu_length);
}
// Calculate number of symbols // Calculate number of symbols
int startSymbolIndex, nrOfSymbols; int startSymbolIndex, nrOfSymbols;
...@@ -1530,12 +1541,15 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1530,12 +1541,15 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx), harq->tb_size = nr_compute_tbs(nr_get_Qm_dl(mcsIndex, mcsTableIdx),
nr_get_code_rate_dl(mcsIndex, mcsTableIdx), nr_get_code_rate_dl(mcsIndex, mcsTableIdx),
rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3; rbSize, nrOfSymbols, N_PRB_DMRS * N_DMRS_SLOT, 0, tb_scaling,1) >> 3;
} while (rbStart + rbSize < BWPSize && !vrb_map[rbStart + rbSize] && harq->tb_size < mac_pdu_length); } while (rbSize < BWPSize && harq->tb_size < ra->mac_pdu_length);
for (int i = 0; (i < rbSize) && (rbStart <= (BWPSize - rbSize)); i++) { int i = 0;
while ((i < rbSize) && (rbStart + rbSize <= BWPSize)) {
if (vrb_map[rbStart + i]) { if (vrb_map[rbStart + i]) {
rbStart += i; rbStart += i+1;
i = 0; i = 0;
} else {
i++;
} }
} }
...@@ -1564,7 +1578,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1564,7 +1578,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu)); dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2 + sizeof(nfapi_nr_dl_tti_pdcch_pdu));
dl_req->nPDUs += 1; dl_req->nPDUs += 1;
pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15; pdcch_pdu_rel15 = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, bwp); nr_configure_pdcch(pdcch_pdu_rel15, ss, coreset, scc, genericParameters, NULL);
nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15; nr_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu_rel15;
} }
...@@ -1681,11 +1695,11 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra ...@@ -1681,11 +1695,11 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
bwpid); bwpid);
// Add padding header and zero rest out if there is space left // Add padding header and zero rest out if there is space left
if (mac_pdu_length < harq->tb_size) { if (ra->mac_pdu_length < harq->tb_size) {
NR_MAC_SUBHEADER_FIXED *padding = (NR_MAC_SUBHEADER_FIXED *) &buf[mac_pdu_length]; NR_MAC_SUBHEADER_FIXED *padding = (NR_MAC_SUBHEADER_FIXED *) &buf[ra->mac_pdu_length];
padding->R = 0; padding->R = 0;
padding->LCID = DL_SCH_LCID_PADDING; padding->LCID = DL_SCH_LCID_PADDING;
for(int k = mac_pdu_length+1; k<harq->tb_size; k++) { for(int k = ra->mac_pdu_length+1; k<harq->tb_size; k++) {
buf[k] = 0; buf[k] = 0;
} }
} }
...@@ -1736,24 +1750,32 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram ...@@ -1736,24 +1750,32 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid]; NR_UE_harq_t *harq = &UE_info->UE_sched_ctrl[UE_id].harq_processes[current_harq_pid];
NR_mac_stats_t *stats = &UE_info->mac_stats[UE_id];
LOG_D(NR_MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid); LOG_D(NR_MAC, "ue %d, rnti %d, harq is waiting %d, round %d, frame %d %d, harq id %d\n", UE_id, ra->rnti, harq->is_waiting, harq->round, frame, slot, current_harq_pid);
if (harq->is_waiting == 0) if (harq->is_waiting == 0) {
{ if (harq->round == 0) {
if (harq->round == 0) if (stats->dlsch_errors == 0) {
{ LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti);
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti); nr_clear_ra_proc(module_id, CC_id, frame, ra);
nr_clear_ra_proc(module_id, CC_id, frame, ra); UE_info->active[UE_id] = true;
UE_info->active[UE_id] = true; UE_info->Msg4_ACKed[UE_id] = true;
UE_info->Msg4_ACKed[UE_id] = true; }
else {
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) RA Procedure failed at Msg4!\n", UE_id, ra->rnti);
nr_mac_remove_ra_rnti(module_id, ra->rnti);
nr_clear_ra_proc(module_id, CC_id, frame, ra);
mac_remove_nr_ue(module_id, ra->rnti);
}
} }
else else {
{ LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Nack of RA-Msg4. Preparing retransmission!\n", UE_id, ra->rnti);
ra->Msg4_frame = (frame + 1) % 1024;
ra->Msg4_slot = 1;
ra->state = Msg4; ra->state = Msg4;
} }
} }
} }
void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra){ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t *ra){
......
...@@ -455,9 +455,7 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -455,9 +455,7 @@ bool allocate_dl_retransmission(module_id_t module_id,
int rbStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); int rbStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; const long f = sched_ctrl->active_bwp ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0;
const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_bwp ? (f ? 1 : (ps->nrOfSymbols == 2 ? 1 : 2)) : (ps->nrOfSymbols == 2 ? 1 : 2);
int rbSize = 0; int rbSize = 0;
const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1; const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1;
if (tda == retInfo->time_domain_allocation) { if (tda == retInfo->time_domain_allocation) {
...@@ -476,9 +474,8 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -476,9 +474,8 @@ bool allocate_dl_retransmission(module_id_t module_id,
} }
/* check whether we need to switch the TDA allocation since the last /* check whether we need to switch the TDA allocation since the last
* (re-)transmission */ * (re-)transmission */
if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data) if (ps->time_domain_allocation != tda)
nr_set_pdsch_semi_static( nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, f, ps);
scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps);
} else { } else {
/* the retransmission will use a different time domain allocation, check /* the retransmission will use a different time domain allocation, check
* that we have enough resources */ * that we have enough resources */
...@@ -487,8 +484,8 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -487,8 +484,8 @@ bool allocate_dl_retransmission(module_id_t module_id,
while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize]) while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize])
rbSize++; rbSize++;
NR_pdsch_semi_static_t temp_ps; NR_pdsch_semi_static_t temp_ps;
nr_set_pdsch_semi_static( temp_ps.nrOfLayers = 1;
scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, &temp_ps); nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, f, &temp_ps);
uint32_t new_tbs; uint32_t new_tbs;
uint16_t new_rbSize; uint16_t new_rbSize;
bool success = nr_find_nb_rb(retInfo->Qm, bool success = nr_find_nb_rb(retInfo->Qm,
...@@ -604,7 +601,7 @@ void pf_dl(module_id_t module_id, ...@@ -604,7 +601,7 @@ void pf_dl(module_id_t module_id,
/* Calculate coeff */ /* Calculate coeff */
sched_pdsch->mcs = 9; sched_pdsch->mcs = 9;
sched_pdsch->nrOfLayers = 1; ps->nrOfLayers = 1;
uint32_t tbs = pf_tbs[ps->mcsTableIdx][sched_pdsch->mcs]; uint32_t tbs = pf_tbs[ps->mcsTableIdx][sched_pdsch->mcs];
coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id]; coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id];
LOG_D(NR_MAC,"b %d, thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n", LOG_D(NR_MAC,"b %d, thr_ue[%d] %f, tbs %d, coeff_ue[%d] %f\n",
...@@ -675,6 +672,7 @@ void pf_dl(module_id_t module_id, ...@@ -675,6 +672,7 @@ void pf_dl(module_id_t module_id,
// Freq-demain allocation // Freq-demain allocation
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
uint16_t max_rbSize = 1; uint16_t max_rbSize = 1;
while (rbStart + max_rbSize < bwpSize && rballoc_mask[rbStart + max_rbSize]) while (rbStart + max_rbSize < bwpSize && rballoc_mask[rbStart + max_rbSize])
max_rbSize++; max_rbSize++;
...@@ -683,11 +681,9 @@ void pf_dl(module_id_t module_id, ...@@ -683,11 +681,9 @@ void pf_dl(module_id_t module_id,
const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1; const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1;
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static; NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats; const long f = sched_ctrl->active_bwp ? sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats : 0;
const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_bwp ? (f ? 1 : (ps->nrOfSymbols == 2 ? 1 : 2)) : (ps->nrOfSymbols == 2 ? 1 : 2); if (ps->time_domain_allocation != tda)
if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data) nr_set_pdsch_semi_static(scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, f, ps);
nr_set_pdsch_semi_static(
scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps);
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx);
sched_pdsch->pucch_allocation = alloc; sched_pdsch->pucch_allocation = alloc;
...@@ -821,17 +817,17 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -821,17 +817,17 @@ void nr_schedule_ue_spec(module_id_t module_id,
const rnti_t rnti = UE_info->rnti[UE_id]; const rnti_t rnti = UE_info->rnti[UE_id];
/* POST processing */
const uint8_t nrOfLayers = sched_pdsch->nrOfLayers;
const uint16_t R = sched_pdsch->R;
const uint8_t Qm = sched_pdsch->Qm;
const uint32_t TBS = sched_pdsch->tb_size;
/* pre-computed PDSCH values that only change if time domain /* pre-computed PDSCH values that only change if time domain
* allocation/DMRS parameters change. Updated in the preprocessor through * allocation/DMRS parameters change. Updated in the preprocessor through
* nr_set_pdsch_semi_static() */ * nr_set_pdsch_semi_static() */
NR_pdsch_semi_static_t *ps = &sched_ctrl->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; int8_t current_harq_pid = sched_pdsch->dl_harq_pid;
if (current_harq_pid < 0) { if (current_harq_pid < 0) {
/* PP has not selected a specific HARQ Process, get a new one */ /* PP has not selected a specific HARQ Process, get a new one */
...@@ -878,6 +874,10 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -878,6 +874,10 @@ 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 /* look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not
* exist, create it */ * exist, create it */
// BWP
NR_BWP_t *genericParameters = bwp ? &bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
const int bwpid = bwp ? bwp->bwp_Id : 0; const int bwpid = bwp ? bwp->bwp_Id : 0;
const int coresetid = bwp ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId; const int coresetid = bwp ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId;
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid]; nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid];
...@@ -891,7 +891,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -891,7 +891,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
LOG_D(NR_MAC,"Trying to configure DL pdcch for bwp %d, cs %d\n",bwpid,coresetid); LOG_D(NR_MAC,"Trying to configure DL pdcch for bwp %d, cs %d\n",bwpid,coresetid);
NR_SearchSpace_t *ss = bwp ? sched_ctrl->search_space:gNB_mac->sched_ctrlCommon->search_space; NR_SearchSpace_t *ss = bwp ? sched_ctrl->search_space:gNB_mac->sched_ctrlCommon->search_space;
NR_ControlResourceSet_t *coreset = bwp? sched_ctrl->coreset:gNB_mac->sched_ctrlCommon->coreset; NR_ControlResourceSet_t *coreset = bwp? sched_ctrl->coreset:gNB_mac->sched_ctrlCommon->coreset;
nr_configure_pdcch(pdcch_pdu, ss, coreset, scc, bwp); nr_configure_pdcch(pdcch_pdu, ss, coreset, scc, genericParameters, NULL);
gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu; gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu;
} }
...@@ -910,9 +910,6 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -910,9 +910,6 @@ void nr_schedule_ue_spec(module_id_t module_id,
const int pduindex = gNB_mac->pdu_index[CC_id]++; const int pduindex = gNB_mac->pdu_index[CC_id]++;
pdsch_pdu->pduIndex = pduindex; pdsch_pdu->pduIndex = pduindex;
// BWP
NR_BWP_t *genericParameters = bwp ? &bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
pdsch_pdu->BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); pdsch_pdu->BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE); pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE);
pdsch_pdu->SubcarrierSpacing = genericParameters->subcarrierSpacing; pdsch_pdu->SubcarrierSpacing = genericParameters->subcarrierSpacing;
...@@ -941,7 +938,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -941,7 +938,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
pdsch_pdu->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu->dlDmrsScramblingId = *scc->physCellId;
pdsch_pdu->SCID = 0; pdsch_pdu->SCID = 0;
pdsch_pdu->numDmrsCdmGrpsNoData = ps->numDmrsCdmGrpsNoData; pdsch_pdu->numDmrsCdmGrpsNoData = ps->numDmrsCdmGrpsNoData;
pdsch_pdu->dmrsPorts = 1; pdsch_pdu->dmrsPorts = (1<<nrOfLayers)-1; // FIXME with a better implementation
// Pdsch Allocation in frequency domain // Pdsch Allocation in frequency domain
pdsch_pdu->resourceAlloc = 1; pdsch_pdu->resourceAlloc = 1;
...@@ -1023,7 +1020,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1023,7 +1020,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
dci_payload.tpc = sched_ctrl->tpc1; // TPC for PUCCH: table 7.2.1-1 in 38.213 dci_payload.tpc = sched_ctrl->tpc1; // TPC for PUCCH: table 7.2.1-1 in 38.213
dci_payload.pucch_resource_indicator = pucch->resource_indicator; dci_payload.pucch_resource_indicator = pucch->resource_indicator;
dci_payload.pdsch_to_harq_feedback_timing_indicator.val = pucch->timing_indicator; // PDSCH to HARQ TI dci_payload.pdsch_to_harq_feedback_timing_indicator.val = pucch->timing_indicator; // PDSCH to HARQ TI
dci_payload.antenna_ports.val = 0; // nb of cdm groups w/o data 1 and dmrs port 0 dci_payload.antenna_ports.val = ps->dmrs_ports_id;
dci_payload.dmrs_sequence_initialization.val = pdsch_pdu->SCID; dci_payload.dmrs_sequence_initialization.val = pdsch_pdu->SCID;
LOG_D(NR_MAC, LOG_D(NR_MAC,
"%4d.%2d DCI type 1 payload: freq_alloc %d (%d,%d,%d), " "%4d.%2d DCI type 1 payload: freq_alloc %d (%d,%d,%d), "
......
...@@ -166,10 +166,10 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -166,10 +166,10 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL, pdsch_pdu_rel15->dlDmrsSymbPos = fill_dmrs_mask(NULL,
scc->dmrs_TypeA_Position, scc->dmrs_TypeA_Position,
NrOfSymbols, NrOfSymbols,
StartSymbolIndex, StartSymbolIndex,
mappingtype); mappingtype);
/* /*
AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n"); AssertFatal(k0==0,"k0 is not zero for Initial DL BWP TimeDomain Alloc\n");
...@@ -369,11 +369,12 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -369,11 +369,12 @@ void nr_preprocessor_phytest(module_id_t module_id,
sched_pdsch->rbSize = rbSize; sched_pdsch->rbSize = rbSize;
const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1; const int tda = sched_ctrl->active_bwp ? RC.nrmac[module_id]->preferred_dl_tda[sched_ctrl->active_bwp->bwp_Id][slot] : 1;
const uint8_t num_dmrs_cdm_grps_no_data = 1; const uint8_t num_dmrs_cdm_grps_no_data = 1;
ps->nrOfLayers = target_dl_Nl;
if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data) if (ps->time_domain_allocation != tda || ps->numDmrsCdmGrpsNoData != num_dmrs_cdm_grps_no_data)
nr_set_pdsch_semi_static( nr_set_pdsch_semi_static(
scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps); scc, UE_info->CellGroup[UE_id], sched_ctrl->active_bwp, tda, num_dmrs_cdm_grps_no_data, ps);
sched_pdsch->nrOfLayers = target_dl_Nl;
sched_pdsch->mcs = target_dl_mcs; sched_pdsch->mcs = target_dl_mcs;
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, ps->mcsTableIdx);
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx); sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, ps->mcsTableIdx);
...@@ -384,7 +385,7 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -384,7 +385,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
ps->N_PRB_DMRS * ps->N_DMRS_SLOT, ps->N_PRB_DMRS * ps->N_DMRS_SLOT,
0 /* N_PRB_oh, 0 for initialBWP */, 0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */, 0 /* tb_scaling */,
sched_pdsch->nrOfLayers) ps->nrOfLayers)
>> 3; >> 3;
/* get the PID of a HARQ process awaiting retransmission, or -1 otherwise */ /* get the PID of a HARQ process awaiting retransmission, or -1 otherwise */
......
...@@ -487,7 +487,7 @@ void nr_csi_meas_reporting(int Mod_idP, ...@@ -487,7 +487,7 @@ void nr_csi_meas_reporting(int Mod_idP,
// preparation is done in first slot of tdd period // preparation is done in first slot of tdd period
if (frame % (period / n_slots_frame) != offset / n_slots_frame) if (frame % (period / n_slots_frame) != offset / n_slots_frame)
continue; continue;
LOG_I(MAC, "CSI reporting in frame %d slot %d\n", frame, sched_slot); LOG_D(MAC, "CSI reporting in frame %d slot %d\n", frame, sched_slot);
const NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0]; const NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0];
const NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 const NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1
...@@ -507,6 +507,7 @@ void nr_csi_meas_reporting(int Mod_idP, ...@@ -507,6 +507,7 @@ void nr_csi_meas_reporting(int Mod_idP,
&& curr_pucch->dai_c == 0, && curr_pucch->dai_c == 0,
"PUCCH not free at index 1 for UE %04x\n", "PUCCH not free at index 1 for UE %04x\n",
UE_info->rnti[UE_id]); UE_info->rnti[UE_id]);
curr_pucch->r_pucch = -1;
curr_pucch->frame = frame; curr_pucch->frame = frame;
curr_pucch->ul_slot = sched_slot; curr_pucch->ul_slot = sched_slot;
curr_pucch->resource_indicator = res_index; curr_pucch->resource_indicator = res_index;
...@@ -985,7 +986,7 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig, ...@@ -985,7 +986,7 @@ void extract_pucch_csi_report(NR_CSI_MeasConfig_t *csi_MeasConfig,
// verify if report with current id has been scheduled for this frame and slot // verify if report with current id has been scheduled for this frame and slot
if ((n_slots_frame*frame + slot - offset)%period == 0) { if ((n_slots_frame*frame + slot - offset)%period == 0) {
reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type; reportQuantity_type = UE_info->csi_report_template[UE_id][csi_report_id].reportQuantity_type;
LOG_I(MAC,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type); LOG_D(MAC,"SFN/SF:%d/%d reportQuantity type = %d\n",frame,slot,reportQuantity_type);
switch(reportQuantity_type){ switch(reportQuantity_type){
case NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP: case NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP:
evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,&cumul_bits,reportQuantity_type); evaluate_rsrp_report(UE_info,sched_ctrl,UE_id,csi_report_id,payload,&cumul_bits,reportQuantity_type);
......
This diff is collapsed.
This diff is collapsed.
...@@ -218,7 +218,7 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn) ...@@ -218,7 +218,7 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn)
bad_sdu = 1; bad_sdu = 1;
} }
if (!bad_sdu && len > 0) { if (!bad_sdu && len > 0) {
memcpy(sdu + so, pdu->data, len); memcpy(sdu + so, pdu->data + so - pdu->so, len);
so += len; so += len;
} }
free(pdu->data); free(pdu->data);
......
This diff is collapsed.
#!/bin/sh #!/bin/sh
test_count=15 test_count=17
for i in `seq $test_count` for i in `seq $test_count`
do do
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment