Commit 94037871 authored by rmagueta's avatar rmagueta

Merge remote-tracking branch 'origin/develop' into develop-SA-CBRA

# Conflicts:
#	openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c
parents 610f12a8 aa7f9f6c
This diff is collapsed.
#!/bin/groovy
/*
* 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
*/
// Template Jenkins Declarative Pipeline script to run Test w/ RF HW
// Location of the python executor node shall be in the same subnet as the others servers
def pythonExecutor = params.pythonExecutor
pipeline {
agent {
label pythonExecutor
}
stages {
stage ("NSA Test Loop") {
steps {
script {
MR_LIST= sh returnStdout: true, script: 'curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests?state=opened&per_page=100&labels=READY_TO_BE_MERGED" | jq ".[].iid" || true '
echo "List of selected MR:\n${MR_LIST}"
def MR_ARRAY = MR_LIST.split('\n')
for (MR in MR_ARRAY) {
SRC_BRANCH=sh returnStdout: true, script: """curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/${MR}" | jq ".source_branch" || true """
SRC_BRANCH=SRC_BRANCH.trim()
COMMIT_ID=sh returnStdout: true, script: """curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/${MR}" | jq ".sha" || true """
COMMIT_ID=COMMIT_ID.trim()
echo "Testing NSA on : ${MR} ${SRC_BRANCH} ${COMMIT_ID}"
//calling sub job
build job: "RAN-CI-NSA-B210", wait : false, propagate : false, parameters: [
string(name: 'eNB_MR', value: String.valueOf(MR)),
string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)),
string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID))
]
}
}
}
}
}
}
This diff is collapsed.
...@@ -23,7 +23,7 @@ gNBs = ...@@ -23,7 +23,7 @@ gNBs =
ssb_SubcarrierOffset = 0; ssb_SubcarrierOffset = 0;
pdsch_AntennaPorts = 1; pdsch_AntennaPorts = 1;
servingCellConfigCommon = ( servingCellConfigCommon = (
{ {
#spCellConfigCommon #spCellConfigCommon
...@@ -227,14 +227,15 @@ MACRLCs = ( ...@@ -227,14 +227,15 @@ MACRLCs = (
num_cc = 1; num_cc = 1;
tr_s_preference = "local_L1"; tr_s_preference = "local_L1";
tr_n_preference = "local_RRC"; tr_n_preference = "local_RRC";
} }
); );
L1s = ( L1s = (
{ {
num_cc = 1; num_cc = 1;
tr_n_preference = "local_mac"; tr_n_preference = "local_mac";
} pusch_proc_threads = 8;
}
); );
RUs = ( RUs = (
...@@ -248,8 +249,15 @@ RUs = ( ...@@ -248,8 +249,15 @@ RUs = (
max_pdschReferenceSignalPower = -27; max_pdschReferenceSignalPower = -27;
max_rxgain = 75; max_rxgain = 75;
eNB_instances = [0]; eNB_instances = [0];
#beamforming 1x4 matrix: ##beamforming 1x2 matrix: 1 layer x 2 antennas
bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; bf_weights = [0x00007fff, 0x0000];
##beamforming 1x4 matrix: 1 layer x 4 antennas
#bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000];
## beamforming 2x2 matrix:
# bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff];
## beamforming 4x4 matrix:
#bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff];
sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2";
clock_src = "external"; clock_src = "external";
} }
......
...@@ -749,7 +749,7 @@ function report_test { ...@@ -749,7 +749,7 @@ function report_test {
echo " </tr>" >> ./test_simulator_results.html echo " </tr>" >> ./test_simulator_results.html
EPC_CONFIGS=("noS1") EPC_CONFIGS=("noS1")
TRANS_MODES=("tdd") TRANS_MODES=("fdd" "tdd")
BW_CASES=(106) BW_CASES=(106)
for CN_CONFIG in ${EPC_CONFIGS[@]} for CN_CONFIG in ${EPC_CONFIGS[@]}
do do
......
...@@ -379,7 +379,7 @@ function check_iperf { ...@@ -379,7 +379,7 @@ function check_iperf {
local LOC_IS_DL=`echo $LOC_BASE_LOG | grep -c _dl` local LOC_IS_DL=`echo $LOC_BASE_LOG | grep -c _dl`
local LOC_IS_BASIC_SIM=`echo $LOC_BASE_LOG | grep -c basic_sim` local LOC_IS_BASIC_SIM=`echo $LOC_BASE_LOG | grep -c basic_sim`
local LOC_IS_RF_SIM=`echo $LOC_BASE_LOG | grep -c rf_sim` local LOC_IS_RF_SIM=`echo $LOC_BASE_LOG | grep -c rf_sim`
local LOC_IS_NR=`echo $LOC_BASE_LOG | grep -c tdd_106prb` local LOC_IS_NR=`echo $LOC_BASE_LOG | grep -c _106prb`
if [ -f ${LOC_BASE_LOG}_client.txt ] if [ -f ${LOC_BASE_LOG}_client.txt ]
then then
local FILE_COMPLETE=`egrep -c "Server Report" ${LOC_BASE_LOG}_client.txt` local FILE_COMPLETE=`egrep -c "Server Report" ${LOC_BASE_LOG}_client.txt`
...@@ -2189,39 +2189,50 @@ function run_test_on_vm { ...@@ -2189,39 +2189,50 @@ function run_test_on_vm {
if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]] if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-rf-sim.* ]]
then then
CN_CONFIG="noS1"
CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf
S1_NOS1_CFG=0
PRB=106
FREQUENCY=3510
if [ ! -d $ARCHIVES_LOC ] if [ ! -d $ARCHIVES_LOC ]
then then
mkdir --parents $ARCHIVES_LOC mkdir --parents $ARCHIVES_LOC
fi fi
local try_cnt=0 CN_CONFIG="noS1"
NR_STATUS=0 S1_NOS1_CFG=0
######### start of RA TEST loop ######### start of RA TEST loop
while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI # for the moment only TDD
TRANS_MODES=("tdd")
for TMODE in ${TRANS_MODES[@]}
do do
if [[ $TMODE =~ .*fdd.* ]]
then
CONF_FILE=gnb.band66.tm1.106PRB.usrpn300.conf
PRB=106
FREQUENCY=37000
else
CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf
PRB=106
FREQUENCY=3510
fi
local try_cnt=0
NR_STATUS=0
while [ $try_cnt -lt 5 ] #5 because it hardly succeed within CI
do
SYNC_STATUS=0 SYNC_STATUS=0
RA_STATUS=0 RA_STATUS=0
rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}*ra_test.log rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}*ra_test.log
echo "############################################################" echo "############################################################"
echo "${CN_CONFIG} : Starting the gNB" echo "${CN_CONFIG} : Starting the gNB in ${TMODE} mode (RA TEST)"
echo "############################################################" echo "############################################################"
CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb_ra_test.log CURRENT_GNB_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_gnb_ra_test.log
#last argument = 1 is to enable --do-ra for RA test #last argument = 1 is to enable --do-ra for RA test
start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 1 start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 1
echo "############################################################" echo "############################################################"
echo "${CN_CONFIG} : Starting the NR-UE" echo "${CN_CONFIG} : Starting the NR-UE in ${TMODE} mode (RA TEST)"
echo "############################################################" echo "############################################################"
CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue_ra_test.log CURRENT_NR_UE_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ue_ra_test.log
#last argument = 1 is to enable --do-ra for RA test #last argument = 1 is to enable --do-ra for RA test
start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1 start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 1
if [ $NR_UE_SYNC -eq 0 ] if [ $NR_UE_SYNC -eq 0 ]
...@@ -2260,35 +2271,47 @@ function run_test_on_vm { ...@@ -2260,35 +2271,47 @@ function run_test_on_vm {
else else
try_cnt=$((try_cnt+10)) try_cnt=$((try_cnt+10))
fi fi
done
done done
########### end RA test ########### end RA test
sleep 30 sleep 30
######### start of PHY TEST loop ######### start of PHY TEST loop
try_cnt=0 SYNC_STATUS=0
while [ $try_cnt -lt 4 ] PING_STATUS=0
IPERF_STATUS=0
TRANS_MODES=("fdd tdd")
for TMODE in ${TRANS_MODES[@]}
do do
if [[ $TMODE =~ .*fdd.* ]]
then
CONF_FILE=gnb.band66.tm1.106PRB.usrpn300.conf
PRB=106
FREQUENCY=37000
else
CONF_FILE=gnb.band78.tm1.106PRB.usrpn300.conf
PRB=106
FREQUENCY=3510
fi
try_cnt=0
SYNC_STATUS=0 while [ $try_cnt -lt 4 ]
PING_STATUS=0 do
IPERF_STATUS=0 rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_gnb.log $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ue.log
rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_gnb.log $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ue.log rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log
rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log rm -f $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_dl*txt $ARCHIVES_LOC/${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_ul*txt
rm -f $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_iperf_dl*txt $ARCHIVES_LOC/tdd_${PRB}prb_${CN_CONFIG}_iperf_ul*txt
echo "############################################################" echo "############################################################"
echo "${CN_CONFIG} : Starting the gNB" echo "${CN_CONFIG} : Starting the gNB in ${TMODE} mode (PHY TEST)"
echo "############################################################" echo "############################################################"
CURRENT_GNB_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_gnb.log CURRENT_GNB_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_gnb.log
start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 0 start_rf_sim_gnb $GNB_VM_CMDS "$GNB_VM_IP_ADDR" $CURRENT_GNB_LOG_FILE $PRB $CONF_FILE $S1_NOS1_CFG 0
echo "############################################################" echo "############################################################"
echo "${CN_CONFIG} : Starting the NR-UE" echo "${CN_CONFIG} : Starting the NR-UE in ${TMODE} mode (PHY TEST)"
echo "############################################################" echo "############################################################"
CURRENT_NR_UE_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ue.log CURRENT_NR_UE_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ue.log
start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 0 start_rf_sim_nr_ue $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $GNB_VM_IP_ADDR $CURRENT_NR_UE_LOG_FILE $PRB $FREQUENCY $S1_NOS1_CFG 0
if [ $NR_UE_SYNC -eq 0 ] if [ $NR_UE_SYNC -eq 0 ]
then then
...@@ -2306,7 +2329,7 @@ function run_test_on_vm { ...@@ -2306,7 +2329,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : Pinging the gNB from NR-UE" echo "${CN_CONFIG} : Pinging the gNB from NR-UE"
echo "############################################################" echo "############################################################"
get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR
PING_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log PING_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ping_gnb_from_nrue.log
ping_epc_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE 1 0 ping_epc_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $ENB_IP_ADDR $PING_LOG_FILE 1 0
scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$NR_UE_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
...@@ -2315,7 +2338,7 @@ function run_test_on_vm { ...@@ -2315,7 +2338,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : Pinging the NR-UE from gNB" echo "${CN_CONFIG} : Pinging the NR-UE from gNB"
echo "############################################################" echo "############################################################"
get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1 get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1
PING_LOG_FILE=tdd_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log PING_LOG_FILE=${TMODE}_${PRB}prb_${CN_CONFIG}_ping_from_gnb_nrue.log
ping_enb_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0 ping_enb_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR $UE_IP_ADDR $PING_LOG_FILE 0
scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$GNB_VM_IP_ADDR:/home/ubuntu/$PING_LOG_FILE $ARCHIVES_LOC
check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20 check_ping_result $ARCHIVES_LOC/$PING_LOG_FILE 20
...@@ -2324,7 +2347,7 @@ function run_test_on_vm { ...@@ -2324,7 +2347,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : iperf DL -- NR-UE is server and gNB is client" echo "${CN_CONFIG} : iperf DL -- NR-UE is server and gNB is client"
echo "############################################################" echo "############################################################"
THROUGHPUT="30K" THROUGHPUT="30K"
CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_dl CURR_IPERF_LOG_BASE=${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_dl
get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR
get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1 get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1
generic_iperf $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0 generic_iperf $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0
...@@ -2346,7 +2369,7 @@ function run_test_on_vm { ...@@ -2346,7 +2369,7 @@ function run_test_on_vm {
echo "${CN_CONFIG} : iperf UL -- gNB is server and NR-UE is client" echo "${CN_CONFIG} : iperf UL -- gNB is server and NR-UE is client"
echo "############################################################" echo "############################################################"
THROUGHPUT="30K" THROUGHPUT="30K"
CURR_IPERF_LOG_BASE=tdd_${PRB}prb_${CN_CONFIG}_iperf_ul CURR_IPERF_LOG_BASE=${TMODE}_${PRB}prb_${CN_CONFIG}_iperf_ul
get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR get_enb_noS1_ip_addr $GNB_VM_CMDS $GNB_VM_IP_ADDR
get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1 get_ue_ip_addr $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR 1
generic_iperf $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0 generic_iperf $GNB_VM_CMDS $GNB_VM_IP_ADDR $ENB_IP_ADDR $NR_UE_VM_CMDS $NR_UE_VM_IP_ADDR $UE_IP_ADDR $THROUGHPUT $CURR_IPERF_LOG_BASE 1 0
...@@ -2368,6 +2391,7 @@ function run_test_on_vm { ...@@ -2368,6 +2391,7 @@ function run_test_on_vm {
else else
try_cnt=$((try_cnt+10)) try_cnt=$((try_cnt+10))
fi fi
done
done done
######### end of loop ######### end of loop
full_l2_sim_destroy full_l2_sim_destroy
......
<!--
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>test-fr1-tm1</htmlTabRef>
<htmlTabName>Test-FR1-TM1</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>1</repeatCount>
<TestCaseRequestedList>
030000
040000
000001
070001
070000
</TestCaseRequestedList>
<TestCaseExclusionList>
</TestCaseExclusionList>
<testCase id="030000">
<class>Initialize_eNB</class>
<desc>Initialize eNB</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf</Initialize_eNB_args>
<eNB_instance>0</eNB_instance>
<eNB_serverId>0</eNB_serverId>
<air_interface>lte</air_interface>
</testCase>
<testCase id="040000">
<class>Initialize_eNB</class>
<desc>Initialize gNB (3/4 sampling rate)</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E</Initialize_eNB_args>
<eNB_instance>1</eNB_instance>
<eNB_serverId>1</eNB_serverId>
<air_interface>nr</air_interface>
</testCase>
<testCase id="000001">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>30</idle_sleep_time_in_sec>
</testCase>
<testCase id="070000">
<class>Terminate_eNB</class>
<desc>Terminate eNB</desc>
<eNB_instance>0</eNB_instance>
<eNB_serverId>0</eNB_serverId>
</testCase>
<testCase id="070001">
<class>Terminate_eNB</class>
<desc>Terminate gNB</desc>
<eNB_instance>1</eNB_instance>
<eNB_serverId>1</eNB_serverId>
</testCase>
</testCaseList>
...@@ -31,14 +31,17 @@ ...@@ -31,14 +31,17 @@
010001 010001
000001 000001
050000 050000
050001
000001 000001
060000 060000
060001 060001
000001 000001
070000
070001
010002 010002
000001 000001
070001 080001
070000 080000
010003 010003
</TestCaseRequestedList> </TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList> <TestCaseExclusionList></TestCaseExclusionList>
...@@ -96,6 +99,13 @@ ...@@ -96,6 +99,13 @@
<ping_packetloss_threshold>50</ping_packetloss_threshold> <ping_packetloss_threshold>50</ping_packetloss_threshold>
</testCase> </testCase>
<testCase id="050001">
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
</testCase>
<testCase id="060000"> <testCase id="060000">
<class>Iperf</class> <class>Iperf</class>
...@@ -113,7 +123,26 @@ ...@@ -113,7 +123,26 @@
<iperf_profile>single-ue</iperf_profile> <iperf_profile>single-ue</iperf_profile>
</testCase> </testCase>
<testCase id="070000"> <testCase id="070000">
<class>Iperf</class>
<desc>iperf (DL/20Mbps/UDP)(20 sec)(single-ue profile)</desc>
<iperf_args>-u -b 20M -t 20 -i 1</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="070001">
<class>Iperf</class>
<desc>iperf (UL/3Mbps/UDP)(20 sec)(single-ue profile)</desc>
<iperf_args>-u -b 3M -t 20 -i 1 -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="080000">
<class>Terminate_eNB</class> <class>Terminate_eNB</class>
<desc>Terminate eNB</desc> <desc>Terminate eNB</desc>
<eNB_instance>0</eNB_instance> <eNB_instance>0</eNB_instance>
...@@ -121,7 +150,7 @@ ...@@ -121,7 +150,7 @@
<air_interface>lte</air_interface> <air_interface>lte</air_interface>
</testCase> </testCase>
<testCase id="070001"> <testCase id="080001">
<class>Terminate_eNB</class> <class>Terminate_eNB</class>
<desc>Terminate gNB</desc> <desc>Terminate gNB</desc>
<eNB_instance>1</eNB_instance> <eNB_instance>1</eNB_instance>
......
<!--
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>TEST-FR1-TM1</htmlTabRef>
<htmlTabName>FR1</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<TestCaseRequestedList>
010000
030000
040000
010001
000001
050000
050001
050002
050002
000001
060000
060001
000001
010002
000001
070001
070000
010003
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="010000">
<class>Initialize_UE</class>
<desc>Initialize UE</desc>
</testCase>
<testCase id="010003">
<class>Terminate_UE</class>
<desc>Terminate UE</desc>
</testCase>
<testCase id="010001">
<class>Attach_UE</class>
<desc>Attach UE</desc>
</testCase>
<testCase id="010002">
<class>Detach_UE</class>
<desc>Detach UE</desc>
</testCase>
<testCase id="030000">
<class>Initialize_eNB</class>
<desc>Initialize eNB</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.fr1.25PRB.usrpb210.conf</Initialize_eNB_args>
<eNB_instance>0</eNB_instance>
<eNB_serverId>0</eNB_serverId>
<air_interface>lte</air_interface>
</testCase>
<testCase id="040000">
<class>Initialize_eNB</class>
<desc>Initialize gNB</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E</Initialize_eNB_args>
<eNB_instance>1</eNB_instance>
<eNB_serverId>1</eNB_serverId>
<air_interface>nr</air_interface>
</testCase>
<testCase id="000001">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>20</idle_sleep_time_in_sec>
</testCase>
<testCase id="050000">
<class>Ping</class>
<desc>Ping: 20pings in 20sec</desc>
<ping_args>-c 20</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
</testCase>
<testCase id="050001">
<class>Ping</class>
<desc>Ping: 5pings in 1sec</desc>
<ping_args>-c 5 -i 0.2</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
</testCase>
<testCase id="050002">
<class>Ping</class>
<desc>Ping: 100pings in 20sec</desc>
<ping_args>-c 100 -i 0.2</ping_args>
<ping_packetloss_threshold>50</ping_packetloss_threshold>
</testCase>
<testCase id="060000">
<class>Iperf</class>
<desc>iperf (DL/1Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 1M -t 30 -i 1</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="060001">
<class>Iperf</class>
<desc>iperf (UL/1Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 1M -t 30 -i 1 -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="070000">
<class>Terminate_eNB</class>
<desc>Terminate eNB</desc>
<eNB_instance>0</eNB_instance>
<eNB_serverId>0</eNB_serverId>
<air_interface>lte</air_interface>
</testCase>
<testCase id="070001">
<class>Terminate_eNB</class>
<desc>Terminate gNB</desc>
<eNB_instance>1</eNB_instance>
<eNB_serverId>1</eNB_serverId>
<air_interface>nr</air_interface>
</testCase>
</testCaseList>
...@@ -1967,7 +1967,8 @@ set(NR_PDCP_SRC ...@@ -1967,7 +1967,8 @@ set(NR_PDCP_SRC
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_oai_api.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_oai_api.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_sdu.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/nr_pdcp_security_nea2.c
${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c ${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c
) )
...@@ -3141,7 +3142,7 @@ target_link_libraries (nr-uesoftmodem ...@@ -3141,7 +3142,7 @@ target_link_libraries (nr-uesoftmodem
RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB RRC_LIB NR_RRC_LIB NGAP_LIB NGAP_GNB SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB
PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB PHY_COMMON PHY_NR_COMMON PHY_UE PHY_NR_UE PHY_RU LFDS NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB
NFAPI_USER_LIB MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB NFAPI_USER_LIB MISC_NFAPI_NR_LIB S1AP_LIB S1AP_ENB
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES}
NFAPI_USER_LIB S1AP_LIB S1AP_ENB NFAPI_USER_LIB S1AP_LIB S1AP_ENB
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${ATLAS_LIBRARIES} LIB_5GNAS_GNB
-Wl,--end-group z dl) -Wl,--end-group z dl)
......
...@@ -88,7 +88,8 @@ int write_file_matlab(const char *fname, ...@@ -88,7 +88,8 @@ int write_file_matlab(const char *fname,
void *data, void *data,
int length, int length,
int dec, int dec,
unsigned int format) unsigned int format,
int multiVec)
{ {
FILE *fp=NULL; FILE *fp=NULL;
int i; int i;
...@@ -100,8 +101,7 @@ int write_file_matlab(const char *fname, ...@@ -100,8 +101,7 @@ int write_file_matlab(const char *fname,
//printf("Writing %d elements of type %d to %s\n",length,format,fname); //printf("Writing %d elements of type %d to %s\n",length,format,fname);
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14 || multiVec) {
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
fp = fopen(fname,"a+"); fp = fopen(fname,"a+");
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) { } else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
fp = fopen(fname,"w+"); fp = fopen(fname,"w+");
...@@ -137,8 +137,7 @@ int write_file_matlab(const char *fname, ...@@ -137,8 +137,7 @@ int write_file_matlab(const char *fname,
return(0); return(0);
} }
if ((format != 10 && format !=11 && format != 12 && format != 13 && format != 14) || multiVec)
if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14)
fprintf(fp,"%s = [",vname); fprintf(fp,"%s = [",vname);
switch (format) { switch (format) {
...@@ -247,7 +246,7 @@ int write_file_matlab(const char *fname, ...@@ -247,7 +246,7 @@ int write_file_matlab(const char *fname,
AssertFatal(false, "unknown dump format: %d\n", format); AssertFatal(false, "unknown dump format: %d\n", format);
} }
if (format != 10 && format !=11 && format !=12 && format != 13 && format != 15) { if ((format != 10 && format !=11 && format !=12 && format != 13 && format != 15) || multiVec) {
fprintf(fp,"];\n"); fprintf(fp,"];\n");
fclose(fp); fclose(fp);
return(0); return(0);
......
...@@ -335,6 +335,7 @@ typedef struct { ...@@ -335,6 +335,7 @@ typedef struct {
@param length length of data vector to output @param length length of data vector to output
@param dec decimation level @param dec decimation level
@param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit) @param format data format (0 = real 16-bit, 1 = complex 16-bit,2 real 32-bit, 3 complex 32-bit,4 = real 8-bit, 5 = complex 8-bit)
@param multiVec create new file or append to existing (useful for writing multiple vectors to same file. Just call the function multiple times with same file name and with this parameter set to 1)
*/ */
#define MATLAB_RAW (1<<31) #define MATLAB_RAW (1<<31)
#define MATLAB_SHORT 0 #define MATLAB_SHORT 0
...@@ -354,7 +355,7 @@ typedef struct { ...@@ -354,7 +355,7 @@ typedef struct {
#define MATLAB_CSHORT_BRACKET2 14 #define MATLAB_CSHORT_BRACKET2 14
#define MATLAB_CSHORT_BRACKET3 15 #define MATLAB_CSHORT_BRACKET3 15
int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format); int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, unsigned int format, int multiVec);
/*----------------macro definitions for reading log configuration from the config module */ /*----------------macro definitions for reading log configuration from the config module */
#define CONFIG_STRING_LOG_PREFIX "log_config" #define CONFIG_STRING_LOG_PREFIX "log_config"
...@@ -414,7 +415,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -414,7 +415,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
/* bitmask dependent macros, to generate debug file such as matlab file or message dump */ /* bitmask dependent macros, to generate debug file such as matlab file or message dump */
# define LOG_DUMPFLAG(D) (g_log->dump_mask & D) # define LOG_DUMPFLAG(D) (g_log->dump_mask & D)
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0)/* */ # define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)/* */
/* define variable only used in LOG macro's */ /* define variable only used in LOG macro's */
# define LOG_VAR(A,B) A B # define LOG_VAR(A,B) A B
# else /* T_TRACER: remove all debugging and tracing messages, except errors */ # else /* T_TRACER: remove all debugging and tracing messages, except errors */
...@@ -431,7 +432,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -431,7 +432,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_DUMPFLAG(D) (g_log->debug_mask & D) # define LOG_DUMPFLAG(D) (g_log->debug_mask & D)
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */ # define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
# define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0) # define LOG_M(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
# define LOG_VAR(A,B) A B # define LOG_VAR(A,B) A B
# endif /* T_TRACER */ # endif /* T_TRACER */
/* avoid warnings for variables only used in LOG macro's but set outside debug section */ /* avoid warnings for variables only used in LOG macro's but set outside debug section */
...@@ -439,9 +440,10 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -439,9 +440,10 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
#define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B #define LOG_USEDINLOG_VAR(A,B) GCC_NOTUSED A B
/* unfiltered macros, useful for simulators or messages at init time, before log is configured */ /* unfiltered macros, useful for simulators or messages at init time, before log is configured */
#define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format);} while(0) #define LOG_UM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 0);} while(0)
#define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0) #define LOG_UI(c, x...) do {logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ; } while(0)
#define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */ #define LOG_UDUMPMSG(c, b, s, f, x...) do { log_dump(c, b, s, f, x) ;} while (0) /* */
# define LOG_MM(file, vector, data, len, dec, format) do { write_file_matlab(file, vector, data, len, dec, format, 1);} while(0)
/* @}*/ /* @}*/
......
...@@ -4,6 +4,7 @@ T_IDs.h ...@@ -4,6 +4,7 @@ T_IDs.h
T_messages.txt.h T_messages.txt.h
genids genids
tracer/enb tracer/enb
tracer/gnb
tracer/extract_config tracer/extract_config
tracer/record tracer/record
tracer/replay tracer/replay
......
ID = BENETEL
GROUP = ALL
FORMAT = int,frame : int,slot : buffer,rxdataF
#general logs #general logs
ID = ENB_MASTER_TICK ID = ENB_MASTER_TICK
DESC = eNodeB master tick - one tick per ms, to be used as "reference clock", mostly for ticktime view DESC = eNodeB master tick - one tick per ms, to be used as "reference clock", mostly for ticktime view
...@@ -93,6 +89,10 @@ ID = GNB_PHY_MIB ...@@ -93,6 +89,10 @@ ID = GNB_PHY_MIB
DESC = NR MIB data DESC = NR MIB data
GROUP = ALL:PHY:GNB:WIRESHARK GROUP = ALL:PHY:GNB:WIRESHARK
FORMAT = int,gNB_ID : int,frame : int,slot : buffer,data FORMAT = int,gNB_ID : int,frame : int,slot : buffer,data
ID = GNB_PHY_PUCCH_PUSCH_IQ
DESC = gNodeB input data in the frequency domain for a slot where some PUCCH or PUSCH detection was done
GROUP = ALL:PHY:GRAPHIC:HEAVY:GNB
FORMAT = int,frame : int,slot : buffer,rxdataF
#MAC logs #MAC logs
ID = ENB_MAC_UE_DL_SDU ID = ENB_MAC_UE_DL_SDU
......
...@@ -7,7 +7,8 @@ LIBS=-lm ...@@ -7,7 +7,8 @@ LIBS=-lm
XLIBS=-lX11 -lpng -lXft XLIBS=-lX11 -lpng -lXft
all: record replay extract_config textlog enb ue vcd macpdu2wireshark \ all: record replay extract_config textlog enb ue vcd macpdu2wireshark \
extract_input_subframe extract_output_subframe to_vcd extract multi extract_input_subframe extract_output_subframe to_vcd extract multi \
gnb
record: utils.o record.o database.o config.o record: utils.o record.o database.o config.o
$(CC) $(CFLAGS) -o record $^ $(LIBS) $(CC) $(CFLAGS) -o record $^ $(LIBS)
...@@ -60,6 +61,11 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \ ...@@ -60,6 +61,11 @@ macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \
multi: multi.o utils.o database.o config.o multi: multi.o utils.o database.o config.o
$(CC) $(CFLAGS) -o multi $^ $(LIBS) $(CC) $(CFLAGS) -o multi $^ $(LIBS)
gnb: utils.o gnb.o database.o event.o handler.o config.o \
view/view.a gui/gui.a logger/logger.a \
filter/filter.a
$(CC) $(CFLAGS) -o gnb $^ $(LIBS) $(XLIBS)
multi.o: ../T_IDs.h multi.o: ../T_IDs.h
../T_IDs.h: ../T_IDs.h:
...@@ -85,7 +91,7 @@ filter/filter.a: ...@@ -85,7 +91,7 @@ filter/filter.a:
clean: clean:
rm -f *.o core tracer_remote textlog enb ue vcd record replay rm -f *.o core tracer_remote textlog enb ue vcd record replay
rm -f extract_config macpdu2wireshark extract_input_subframe rm -f extract_config macpdu2wireshark extract_input_subframe
rm -f extract_output_subframe to_vcd extract multi rm -f extract_output_subframe to_vcd extract multi gnb
cd gui && $(MAKE) clean cd gui && $(MAKE) clean
cd view && $(MAKE) clean cd view && $(MAKE) clean
cd logger && $(MAKE) clean cd logger && $(MAKE) clean
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
#include "database.h"
#include "handler.h"
#include "config.h"
#include "logger/logger.h"
#include "view/view.h"
#include "gui/gui.h"
typedef struct {
widget *pucch_pusch_iq_plot;
logger *pucch_pusch_iq_logger;
} gnb_gui;
typedef struct {
int socket;
int *is_on;
int nevents;
pthread_mutex_t lock;
gnb_gui *e;
void *database;
} gnb_data;
void is_on_changed(void *_d)
{
gnb_data *d = _d;
char t;
if (pthread_mutex_lock(&d->lock)) abort();
if (d->socket == -1) goto no_connection;
t = 1;
if (socket_send(d->socket, &t, 1) == -1 ||
socket_send(d->socket, &d->nevents, sizeof(int)) == -1 ||
socket_send(d->socket, d->is_on, d->nevents * sizeof(int)) == -1)
goto connection_dies;
no_connection:
if (pthread_mutex_unlock(&d->lock)) abort();
return;
connection_dies:
close(d->socket);
d->socket = -1;
if (pthread_mutex_unlock(&d->lock)) abort();
}
void usage(void)
{
printf(
"options:\n"
" -d <database file> this option is mandatory\n"
" -ip <host> connect to given IP address (default %s)\n"
" -p <port> connect to given port (default %d)\n",
DEFAULT_REMOTE_IP,
DEFAULT_REMOTE_PORT
);
exit(1);
}
static void *gui_thread(void *_g)
{
gui *g = _g;
gui_loop(g);
return NULL;
}
static void gnb_main_gui(gnb_gui *e, gui *g, event_handler *h, void *database,
gnb_data *ed)
{
widget *main_window;
widget *top_container;
widget *line;
widget *w;
logger *l;
view *v;
main_window = new_toplevel_window(g, 500, 300, "gNB tracer");
top_container = new_container(g, VERTICAL);
widget_add_child(g, main_window, top_container, -1);
line = new_container(g, HORIZONTAL);
widget_add_child(g, top_container, line, -1);
/* PUCCH/PUSCH IQ data */
w = new_xy_plot(g, 55, 55, "", 50);
e->pucch_pusch_iq_plot = w;
widget_add_child(g, line, w, -1);
xy_plot_set_range(g, w, -1000, 1000, -1000, 1000);
xy_plot_set_title(g, w, "rxdataF");
l = new_iqlog_full(h, database, "GNB_PHY_PUCCH_PUSCH_IQ", "rxdataF");
v = new_view_xy(300*12*14,10,g,w,new_color(g,"#000"),XY_FORCED_MODE);
logger_add_view(l, v);
e->pucch_pusch_iq_logger = l;
}
int main(int n, char **v)
{
char *database_filename = NULL;
void *database;
char *ip = DEFAULT_REMOTE_IP;
int port = DEFAULT_REMOTE_PORT;
int *is_on;
int number_of_events;
int i;
event_handler *h;
gnb_data gnb_data;
gui *g;
gnb_gui eg;
for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
if (!strcmp(v[i], "-d"))
{ if (i > n-2) usage(); database_filename = v[++i]; continue; }
usage();
}
if (database_filename == NULL) {
printf("ERROR: provide a database file (-d)\n");
exit(1);
}
database = parse_database(database_filename);
load_config_file(database_filename);
number_of_events = number_of_ids(database);
is_on = calloc(number_of_events, sizeof(int));
if (is_on == NULL) abort();
h = new_handler(database);
on_off(database, "GNB_PHY_PUCCH_PUSCH_IQ", is_on, 1);
gnb_data.database = database;
gnb_data.socket = -1;
gnb_data.is_on = is_on;
gnb_data.nevents = number_of_events;
if (pthread_mutex_init(&gnb_data.lock, NULL)) abort();
g = gui_init();
new_thread(gui_thread, g);
gnb_main_gui(&eg, g, h, database, &gnb_data);
OBUF ebuf = { osize: 0, omaxsize: 0, obuf: NULL };
restart:
clear_remote_config();
if (gnb_data.socket != -1) close(gnb_data.socket);
gnb_data.socket = connect_to(ip, port);
/* send the first message - activate selected traces */
is_on_changed(&gnb_data);
/* read messages */
while (1) {
event e;
e = get_event(gnb_data.socket, &ebuf, database);
if (e.type == -1) goto restart;
if (pthread_mutex_lock(&gnb_data.lock)) abort();
handle_event(h, e);
if (pthread_mutex_unlock(&gnb_data.lock)) abort();
}
return 0;
}
...@@ -74,6 +74,44 @@ static void _event(void *p, event e) ...@@ -74,6 +74,44 @@ static void _event(void *p, event e)
l->common.v[i]->append(l->common.v[i], l->i, l->q, count); l->common.v[i]->append(l->common.v[i], l->i, l->q, count);
} }
static void _event_full(void *p, event e)
{
struct iqlog *l = p;
int i;
void *buffer;
int bsize;
int nsamples;
float *idst, *qdst;
if (l->common.filter != NULL && filter_eval(l->common.filter, e) == 0)
return;
buffer = e.e[l->buffer_arg].b;
bsize = e.e[l->buffer_arg].bsize;
nsamples = bsize / 4;
if (nsamples > l->max_length) {
l->i = realloc(l->i, nsamples * sizeof(float));
if (l->i == NULL) abort();
l->q = realloc(l->q, nsamples * sizeof(float));
if (l->q == NULL) abort();
l->max_length = nsamples;
}
idst = l->i;
qdst = l->q;
for (i = 0; i < nsamples; i++) {
*idst = ((int16_t *)buffer)[i * 2];
*qdst = ((int16_t *)buffer)[i * 2 + 1];
idst++;
qdst++;
}
for (i = 0; i < l->common.vsize; i++)
l->common.v[i]->append(l->common.v[i], l->i, l->q, nsamples);
}
logger *new_iqlog(event_handler *h, void *database, logger *new_iqlog(event_handler *h, void *database,
char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti, char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti,
char *buffer_varname) char *buffer_varname)
...@@ -149,3 +187,43 @@ logger *new_iqlog(event_handler *h, void *database, ...@@ -149,3 +187,43 @@ logger *new_iqlog(event_handler *h, void *database,
return ret; return ret;
} }
logger *new_iqlog_full(event_handler *h, void *database, char *event_name,
char *buffer_varname)
{
struct iqlog *ret;
int event_id;
database_event_format f;
int i;
ret = calloc(1, sizeof(struct iqlog)); if (ret == NULL) abort();
ret->common.event_name = strdup(event_name);
if (ret->common.event_name == NULL) abort();
ret->database = database;
event_id = event_id_from_name(database, event_name);
ret->common.handler_id = register_handler_function(h, event_id, _event_full,
ret);
f = get_format(database, event_id);
/* look for args */
ret->buffer_arg = -1;
for (i = 0; i < f.count; i++) {
if (!strcmp(f.name[i], buffer_varname)) ret->buffer_arg = i;
}
if (ret->buffer_arg == -1) {
printf("%s:%d: buffer argument '%s' not found in event '%s'\n",
__FILE__, __LINE__, buffer_varname, event_name);
abort();
}
if (strcmp(f.type[ret->buffer_arg], "buffer") != 0) {
printf("%s:%d: argument '%s' has wrong type (should be 'buffer')\n",
__FILE__, __LINE__, buffer_varname);
abort();
}
return ret;
}
...@@ -23,6 +23,8 @@ logger *new_ticklog(void *event_handler, void *database, ...@@ -23,6 +23,8 @@ logger *new_ticklog(void *event_handler, void *database,
logger *new_iqlog(void *event_handler, void *database, logger *new_iqlog(void *event_handler, void *database,
char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti, char *event_name, char *nb_rb, char *N_RB_UL, char *symbols_per_tti,
char *buffer_varname); char *buffer_varname);
logger *new_iqlog_full(void *event_handler, void *database, char *event_name,
char *buffer_varname);
logger *new_iqdotlog(void *event_handler, void *database, logger *new_iqdotlog(void *event_handler, void *database,
char *event_name, char *I, char *Q); char *event_name, char *I, char *Q);
......
...@@ -32,6 +32,81 @@ ...@@ -32,6 +32,81 @@
#include <stdint.h> #include <stdint.h>
#include "assertions.h" #include "assertions.h"
#include "nr_common.h"
// Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101)
// Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101)
// Notes:
// - N_OFFs for bands from 80 to 89 and band 95 is referred to UL
// - Frequencies are expressed in KHz
// - col: NR_band ul_min ul_max dl_min dl_max step N_OFFs_DL deltaf_raster
nr_bandentry_t nr_bandtable[] = {
{1, 1920000, 1980000, 2110000, 2170000, 20, 422000, 100},
{2, 1850000, 1910000, 1930000, 1990000, 20, 386000, 100},
{3, 1710000, 1785000, 1805000, 1880000, 20, 361000, 100},
{5, 824000, 849000, 869000, 894000, 20, 173800, 100},
{7, 2500000, 2570000, 2620000, 2690000, 20, 524000, 100},
{8, 880000, 915000, 925000, 960000, 20, 185000, 100},
{12, 698000, 716000, 729000, 746000, 20, 145800, 100},
{14, 788000, 798000, 758000, 768000, 20, 151600, 100},
{18, 815000, 830000, 860000, 875000, 20, 172000, 100},
{20, 832000, 862000, 791000, 821000, 20, 158200, 100},
{25, 1850000, 1915000, 1930000, 1995000, 20, 386000, 100},
{26, 814000, 849000, 859000, 894000, 20, 171800, 100},
{28, 703000, 758000, 758000, 813000, 20, 151600, 100},
{29, 000, 000, 717000, 728000, 20, 143400, 100},
{30, 2305000, 2315000, 2350000, 2360000, 20, 470000, 100},
{34, 2010000, 2025000, 2010000, 2025000, 20, 402000, 100},
{38, 2570000, 2620000, 2570000, 2630000, 20, 514000, 100},
{39, 1880000, 1920000, 1880000, 1920000, 20, 376000, 100},
{40, 2300000, 2400000, 2300000, 2400000, 20, 460000, 100},
{41, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
{41, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
{47, 5855000, 5925000, 5855000, 5925000, 1, 790334, 15},
//{48, 3550000, 3700000, 3550000, 3700000, 1, 636667, 15},
//{48, 3550000, 3700000, 3550000, 3700000, 2, 636668, 30},
{50, 1432000, 1517000, 1432000, 1517000, 20, 286400, 100},
{51, 1427000, 1432000, 1427000, 1432000, 20, 285400, 100},
{53, 2483500, 2495000, 2483500, 2495000, 20, 496700, 100},
{65, 1920000, 2010000, 2110000, 2200000, 20, 422000, 100},
{66, 1710000, 1780000, 2110000, 2200000, 20, 422000, 100},
{70, 1695000, 1710000, 1995000, 2020000, 20, 399000, 100},
{71, 663000, 698000, 617000, 652000, 20, 123400, 100},
{74, 1427000, 1470000, 1475000, 1518000, 20, 295000, 100},
{75, 000, 000, 1432000, 1517000, 20, 286400, 100},
{76, 000, 000, 1427000, 1432000, 20, 285400, 100},
{77, 3300000, 4200000, 3300000, 4200000, 1, 620000, 15},
{77, 3300000, 4200000, 3300000, 4200000, 2, 620000, 30},
{78, 3300000, 3800000, 3300000, 3800000, 1, 620000, 15},
{78, 3300000, 3800000, 3300000, 3800000, 2, 620000, 30},
{79, 4400010, 5000000, 4400010, 5000000, 1, 693334, 15},
{79, 4400010, 5000000, 4400010, 5000000, 2, 693334, 30},
{80, 1710000, 1785000, 000, 000, 20, 342000, 100},
{81, 880000, 915000, 000, 000, 20, 176000, 100},
{82, 832000, 862000, 000, 000, 20, 166400, 100},
{83, 703000, 748000, 000, 000, 20, 140600, 100},
{84, 1920000, 1980000, 000, 000, 20, 384000, 100},
{86, 1710000, 1785000, 000, 000, 20, 342000, 100},
{89, 824000, 849000, 000, 000, 20, 342000, 100},
{90, 2496000, 2690000, 2496000, 2690000, 3, 499200, 15},
{90, 2496000, 2690000, 2496000, 2690000, 6, 499200, 30},
{90, 2496000, 2690000, 2496000, 2690000, 20, 499200, 100},
{91, 832000, 862000, 1427000, 1432000, 20, 285400, 100},
{92, 832000, 862000, 1432000, 1517000, 20, 286400, 100},
{93, 880000, 915000, 1427000, 1432000, 20, 285400, 100},
{94, 880000, 915000, 1432000, 1517000, 20, 286400, 100},
{95, 2010000, 2025000, 000, 000, 20, 402000, 100},
{257,26500020,29500000,26500020,29500000, 1,2054166, 60},
{257,26500080,29500000,26500080,29500000, 2,2054167, 120},
{258,24250080,27500000,24250080,27500000, 1,2016667, 60},
{258,24250080,27500000,24250080,27500000, 2,2016667, 120},
{260,37000020,40000000,37000020,40000000, 1,2229166, 60},
{260,37000080,40000000,37000080,40000000, 2,2229167, 120},
{261,27500040,28350000,27500040,28350000, 1,2070833, 60},
{261,27500040,28350000,27500040,28350000, 2,2070833, 120}
};
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) {
int tmp = locationAndBandwidth/N_RB; int tmp = locationAndBandwidth/N_RB;
......
...@@ -36,6 +36,20 @@ ...@@ -36,6 +36,20 @@
#include <stdint.h> #include <stdint.h>
#include "assertions.h" #include "assertions.h"
typedef struct nr_bandentry_s {
int16_t band;
uint64_t ul_min;
uint64_t ul_max;
uint64_t dl_min;
uint64_t dl_max;
uint64_t step_size;
uint64_t N_OFFs_DL;
uint8_t deltaf_raster;
} nr_bandentry_t;
extern const size_t nr_bandtable_size;
extern nr_bandentry_t nr_bandtable[];
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);
......
...@@ -169,7 +169,7 @@ With the RF simulator (on the same machine): ...@@ -169,7 +169,7 @@ With the RF simulator (on the same machine):
## IF setup with OAI ## IF setup with OAI
The -C and -CO flags can be used together at UE side to set custom downlink and uplink FR1 intermediate frequencies for the IF equipment. The -C and --CO flags can be used together at UE side to set custom downlink and uplink FR1 arbitrary frequencies for the IF equipment.
In order to run this setup, the following flags are needed at the UE side: In order to run this setup, the following flags are needed at the UE side:
...@@ -183,9 +183,11 @@ and the following parameters must be configured in the RUs section of the gNB co ...@@ -183,9 +183,11 @@ and the following parameters must be configured in the RUs section of the gNB co
`if_offset` `if_offset`
### Run OAI with custom DL/UL intermediate frequencies The values must be given in Hz.
The following example uses DL frequency 2169.080 MHz and UL frequency offset -400 MHz, with a configuration file for band 66 at gNB side. ### Run OAI with custom DL/UL arbitrary frequencies
The following example uses DL frequency 2169.080 MHz and UL frequency offset -400 MHz, with a configuration file for band 66 (FDD) at gNB side.
From the `cmake_targets/ran_build/build` folder: From the `cmake_targets/ran_build/build` folder:
......
This diff is collapsed.
This diff is collapsed.
...@@ -703,16 +703,23 @@ void *UE_thread(void *arg) { ...@@ -703,16 +703,23 @@ void *UE_thread(void *arg) {
int flags = 0; int flags = 0;
int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH; int slot_tx_usrp = slot_nr + DURATION_RX_TO_TX - RX_NB_TH;
uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots;
uint8_t num_UL_slots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots + if (openair0_cfg[0].duplex_mode == duplex_mode_TDD) {
(mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSymbols!=0);
uint8_t first_tx_slot = tdd_period - num_UL_slots; uint8_t tdd_period = mac->phy_config.config_req.tdd_table.tdd_period_in_slots;
if (slot_tx_usrp%tdd_period==first_tx_slot) int nrofUplinkSlots = mac->scc->tdd_UL_DL_ConfigurationCommon->pattern1.nrofUplinkSlots;
flags=2; uint8_t num_UL_slots = nrofUplinkSlots + (nrofUplinkSlots != 0);
else if (slot_tx_usrp%tdd_period==first_tx_slot+num_UL_slots-1) uint8_t first_tx_slot = tdd_period - num_UL_slots;
flags = 3;
else if (slot_tx_usrp%tdd_period>first_tx_slot) if (slot_tx_usrp % tdd_period == first_tx_slot)
flags = 2;
else if (slot_tx_usrp % tdd_period == first_tx_slot + num_UL_slots - 1)
flags = 3;
else if (slot_tx_usrp % tdd_period > first_tx_slot)
flags = 1;
} else {
flags = 1; flags = 1;
}
if (flags || IS_SOFTMODEM_RFSIM) if (flags || IS_SOFTMODEM_RFSIM)
AssertFatal( writeBlockSize == AssertFatal( writeBlockSize ==
......
...@@ -548,7 +548,8 @@ int main( int argc, char **argv ) { ...@@ -548,7 +548,8 @@ int main( int argc, char **argv ) {
fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config; fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config;
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->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]);
init_symbol_rotation(&UE[CC_id]->frame_parms, UE[CC_id]->frame_parms.dl_CarrierFreq);
init_symbol_rotation(&UE[CC_id]->frame_parms);
init_nr_ue_vars(UE[CC_id], 0, abstraction_flag); init_nr_ue_vars(UE[CC_id], 0, abstraction_flag);
#ifdef FR2_TEST #ifdef FR2_TEST
......
...@@ -244,6 +244,13 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr); ...@@ -244,6 +244,13 @@ extern char *get_softmodem_function(uint64_t *sofmodemfunc_mask_ptr);
extern void set_softmodem_sighandler(void); extern void set_softmodem_sighandler(void);
extern uint64_t downlink_frequency[MAX_NUM_CCs][4]; extern uint64_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
extern uint16_t sl_ahead;
extern uint16_t sf_ahead;
extern volatile int oai_exit;
void tx_func(void *param);
void rx_func(void *param);
void ru_tx_func(void *param);
extern uint8_t nfapi_mode; extern uint8_t nfapi_mode;
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
*/ */
#include "executables/nr-softmodem-common.h" #include "executables/nr-softmodem-common.h"
#include "common/utils/nr/nr_common.h"
#include "PHY/defs_gNB.h" #include "PHY/defs_gNB.h"
#include "PHY/phy_extern.h" #include "PHY/phy_extern.h"
#include "PHY/NR_REFSIG/nr_refsig.h" #include "PHY/NR_REFSIG/nr_refsig.h"
...@@ -45,10 +46,42 @@ ...@@ -45,10 +46,42 @@
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h" #include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
/* static
extern uint32_t from_nrarfcn(int nr_bandP,uint32_t dl_nrarfcn); uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex)
extern openair0_config_t openair0_cfg[MAX_CARDS]; {
*/ 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() {
...@@ -455,7 +488,6 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -455,7 +488,6 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
uint8_t short_sequence, num_sequences, rootSequenceIndex, fd_occasion; uint8_t short_sequence, num_sequences, rootSequenceIndex, fd_occasion;
NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms; NR_DL_FRAME_PARMS *fp = &RC.gNB[Mod_id]->frame_parms;
nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config; nfapi_nr_config_request_scf_t *gNB_config = &RC.gNB[Mod_id]->gNB_config;
int32_t dlul_offset = 0;
memcpy((void*)gNB_config,phy_config->cfg,sizeof(*phy_config->cfg)); memcpy((void*)gNB_config,phy_config->cfg,sizeof(*phy_config->cfg));
RC.gNB[Mod_id]->mac_enabled = 1; RC.gNB[Mod_id]->mac_enabled = 1;
...@@ -466,16 +498,9 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -466,16 +498,9 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value); uint64_t ul_bw_khz = (12*gNB_config->carrier_config.ul_grid_size[gNB_config->ssb_config.scs_common.value].value)*(15<<gNB_config->ssb_config.scs_common.value);
fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ; fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ;
//fp->nr_band = *RC.nrmac[Mod_id]->common_channels[0].ServingCellConfigCommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; int32_t dlul_offset = fp->ul_CarrierFreq - fp->dl_CarrierFreq;
lte_frame_type_t frame_type = 0; // FDD fp->nr_band = get_band(fp->dl_CarrierFreq, dlul_offset);
get_band(fp->dl_CarrierFreq,&fp->nr_band,&dlul_offset,&frame_type); //RC.nrmac[Mod_id] cannot be accessed in NFAPI
get_delta_duplex(fp->nr_band, gNB_config->ssb_config.scs_common.value, &dlul_offset);
dlul_offset *= 1000;
AssertFatal(fp->ul_CarrierFreq == (fp->dl_CarrierFreq + dlul_offset), "Disagreement in uplink frequency for band %d: ul_CarrierFreq = %lu Hz vs expected %lu Hz\n", fp->nr_band, fp->ul_CarrierFreq, fp->dl_CarrierFreq + dlul_offset);
LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset); LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset);
fp->threequarter_fs = openair0_cfg[0].threequarter_fs; fp->threequarter_fs = openair0_cfg[0].threequarter_fs;
...@@ -504,7 +529,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) { ...@@ -504,7 +529,7 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
// } // }
RC.gNB[Mod_id]->configured = 1; RC.gNB[Mod_id]->configured = 1;
init_symbol_rotation(fp,fp->dl_CarrierFreq); init_symbol_rotation(fp);
LOG_I(PHY,"gNB %d configured\n",Mod_id); LOG_I(PHY,"gNB %d configured\n",Mod_id);
} }
......
...@@ -352,9 +352,8 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, ...@@ -352,9 +352,8 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
fp->N_RB_UL = config->carrier_config.ul_grid_size[fp->numerology_index]; fp->N_RB_UL = config->carrier_config.ul_grid_size[fp->numerology_index];
fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index]; fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index];
int32_t uplink_frequency_offset = 0; fp->frame_type = get_frame_type(fp->nr_band, fp->numerology_index);
get_delta_duplex(fp->nr_band, fp->numerology_index, &uplink_frequency_offset); int32_t uplink_frequency_offset = get_delta_duplex(fp->nr_band, fp->numerology_index);
get_frame_type(fp->nr_band, fp->numerology_index, &fp->frame_type);
uplink_frequency_offset *= 1000; uplink_frequency_offset *= 1000;
LOG_I(PHY, "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, uplink_frequency_offset); LOG_I(PHY, "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, uplink_frequency_offset);
......
...@@ -591,35 +591,63 @@ void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH) ...@@ -591,35 +591,63 @@ void nr_dft(int32_t *z, int32_t *d, uint32_t Msc_PUSCH)
} }
void init_symbol_rotation(NR_DL_FRAME_PARMS *fp,uint64_t CarrierFreq) { void init_symbol_rotation(NR_DL_FRAME_PARMS *fp) {
uint64_t dl_CarrierFreq = fp->dl_CarrierFreq;
uint64_t ul_CarrierFreq = fp->ul_CarrierFreq;
double f[2] = {(double)dl_CarrierFreq, (double)ul_CarrierFreq};
const int nsymb = fp->symbols_per_slot * fp->slots_per_frame/10; const int nsymb = fp->symbols_per_slot * fp->slots_per_frame/10;
const double Tc=(1/480e3/4096); const double Tc=(1/480e3/4096);
const double Nu=2048*64*(1/(float)(1<<fp->numerology_index)); const double Nu=2048*64*(1/(float)(1<<fp->numerology_index));
const double f0= (double)CarrierFreq;
const double Ncp0=16*64 + (144*64*(1/(float)(1<<fp->numerology_index))); const double Ncp0=16*64 + (144*64*(1/(float)(1<<fp->numerology_index)));
const double Ncp1=(144*64*(1/(float)(1<<fp->numerology_index))); const double Ncp1=(144*64*(1/(float)(1<<fp->numerology_index)));
double tl=0,poff,exp_re,exp_im;
double Ncp,Ncpm1=Ncp0; for (uint8_t ll = 0; ll < 2; ll++){
poff = 2*M_PI*((Ncp0*Tc))*f0; double f0 = f[ll];
exp_re = cos(poff); double Ncpm1 = Ncp0;
exp_im = sin(-poff); int16_t *symbol_rotation = fp->symbol_rotation[ll];
fp->symbol_rotation[0]=(int16_t)floor(exp_re*32767);
fp->symbol_rotation[1]=(int16_t)floor(exp_im*32767); double tl = 0;
LOG_I(PHY,"Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n",f0,nsymb); double poff = 2 * M_PI * ((Ncp0 * Tc)) * f0;
LOG_I(PHY,"Symbol rotation %d/%d => (%d,%d)\n",0,nsymb,fp->symbol_rotation[0],fp->symbol_rotation[1]); double exp_re = cos(poff);
for (int l=1;l<nsymb;l++) { double exp_im = sin(-poff);
if (l==(7*(1<<fp->numerology_index))) Ncp=Ncp0; symbol_rotation[0] = (int16_t)floor(exp_re * 32767);
else Ncp=Ncp1; symbol_rotation[1] = (int16_t)floor(exp_im * 32767);
tl += (Nu+Ncpm1)*Tc; LOG_I(PHY, "Doing symbol rotation calculation for gNB TX/RX, f0 %f Hz, Nsymb %d\n", f0, nsymb);
poff = 2*M_PI*(tl + (Ncp*Tc))*f0; LOG_I(PHY, "Symbol rotation %d/%d => (%d,%d)\n",
exp_re = cos(poff); 0,
exp_im = sin(-poff); nsymb,
fp->symbol_rotation[l<<1]=(int16_t)floor(exp_re*32767); symbol_rotation[0],
fp->symbol_rotation[1+(l<<1)]=(int16_t)floor(exp_im*32767); symbol_rotation[1]);
LOG_I(PHY,"Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n",l,nsymb,tl,fp->symbol_rotation[l<<1],fp->symbol_rotation[1+(l<<1)],
(poff/2/M_PI)-floor(poff/2/M_PI)); for (int l = 1; l < nsymb; l++) {
Ncpm1=Ncp;
double Ncp;
if (l == (7 * (1 << fp->numerology_index))) {
Ncp = Ncp0;
} else {
Ncp = Ncp1;
}
tl += (Nu + Ncpm1) * Tc;
poff = 2 * M_PI * (tl + (Ncp * Tc)) * f0;
exp_re = cos(poff);
exp_im = sin(-poff);
symbol_rotation[l<<1] = (int16_t)floor(exp_re * 32767);
symbol_rotation[1 + (l<<1)] = (int16_t)floor(exp_im * 32767);
LOG_I(PHY, "Symbol rotation %d/%d => tl %f (%d,%d) (%f)\n",
l,
nsymb,
tl,
symbol_rotation[l<<1],
symbol_rotation[1 + (l<<1)],
(poff / 2 / M_PI) - floor(poff / 2 / M_PI));
Ncpm1 = Ncp;
}
} }
} }
...@@ -110,7 +110,7 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, ...@@ -110,7 +110,7 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
int nsymb, int nsymb,
int length); int length);
void init_symbol_rotation(NR_DL_FRAME_PARMS *fp,uint64_t CarrierFreq); void init_symbol_rotation(NR_DL_FRAME_PARMS *fp);
void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
int32_t *rxdataF, int32_t *rxdataF,
......
...@@ -306,15 +306,23 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp, ...@@ -306,15 +306,23 @@ void apply_nr_rotation(NR_DL_FRAME_PARMS *fp,
int length) { int length) {
int symb_offset = (slot%fp->slots_per_subframe)*fp->symbols_per_slot; int symb_offset = (slot%fp->slots_per_subframe)*fp->symbols_per_slot;
int16_t *symbol_rotation = fp->symbol_rotation[0];
for (int sidx=0;sidx<nsymb;sidx++) { for (int sidx=0;sidx<nsymb;sidx++) {
LOG_D(PHY,"Rotating symbol %d, slot %d, symbol_subframe_index %d, length %d (%d,%d)\n", LOG_D(PHY,"Rotating symbol %d, slot %d, symbol_subframe_index %d, length %d (%d,%d)\n",
first_symbol+sidx,slot,sidx+first_symbol+symb_offset,length, first_symbol + sidx,
fp->symbol_rotation[2*(sidx+first_symbol+symb_offset)],fp->symbol_rotation[1+2*(sidx+first_symbol+symb_offset)]); slot,
rotate_cpx_vector(trxdata+(sidx*length*2), sidx + first_symbol + symb_offset,
&fp->symbol_rotation[2*(sidx+first_symbol+symb_offset)], length,
trxdata+(sidx*length*2), symbol_rotation[2 * (sidx + first_symbol + symb_offset)],
length, symbol_rotation[1 + 2 * (sidx + first_symbol + symb_offset)]);
15);
rotate_cpx_vector(trxdata + (sidx * length * 2),
&symbol_rotation[2 * (sidx + first_symbol + symb_offset)],
trxdata + (sidx * length * 2),
length,
15);
} }
} }
...@@ -205,7 +205,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue, ...@@ -205,7 +205,7 @@ int nr_slot_fep(PHY_VARS_NR_UE *ue,
#endif #endif
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset]; int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol + symb_offset];
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
rotate_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol], rotate_cpx_vector((int16_t *)&common_vars->common_vars_rx_data_per_thread[proc->thread_id].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],
(int16_t*)&rot2, (int16_t*)&rot2,
...@@ -386,7 +386,7 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue, ...@@ -386,7 +386,7 @@ int nr_slot_fep_init_sync(PHY_VARS_NR_UE *ue,
} }
int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; int symb_offset = (Ns%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset]; int32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[0])[symbol + symb_offset];
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
#ifdef DEBUG_FEP #ifdef DEBUG_FEP
...@@ -513,7 +513,7 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms, ...@@ -513,7 +513,7 @@ void apply_nr_rotation_ul(NR_DL_FRAME_PARMS *frame_parms,
for (int symbol=0;symbol<nsymb;symbol++) { for (int symbol=0;symbol<nsymb;symbol++) {
uint32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation)[symbol+symb_offset]; uint32_t rot2 = ((uint32_t*)frame_parms->symbol_rotation[1])[symbol + symb_offset];
((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1]; ((int16_t*)&rot2)[1]=-((int16_t*)&rot2)[1];
LOG_D(PHY,"slot %d, symb_offset %d rotating by %d.%d\n",slot,symb_offset,((int16_t*)&rot2)[0],((int16_t*)&rot2)[1]); LOG_D(PHY,"slot %d, symb_offset %d rotating by %d.%d\n",slot,symb_offset,((int16_t*)&rot2)[0],((int16_t*)&rot2)[1]);
rotate_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol], rotate_cpx_vector((int16_t *)&rxdataF[frame_parms->ofdm_symbol_size*symbol],
......
...@@ -79,12 +79,17 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -79,12 +79,17 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
uint16_t nb_rb_pusch = pusch_pdu->rb_size; uint16_t nb_rb_pusch = pusch_pdu->rb_size;
/*
#ifdef DEBUG_CH #ifdef DEBUG_CH
printf("PUSCH Channel Estimation : ch_offset %d, symbol_offset %d OFDM size %d, Ncp=%d, l=%d, Ns=%d, k=%d symbol %d\n", ,ch_offset,symbol_offset,gNB->frame_parms.ofdm_symbol_size, LOG_D(PHY, "In %s: ch_offset %d, symbol_offset %d OFDM size %d, Ns = %d, k = %d symbol %d\n",
gNB->frame_parms.Ncp,l,Ns,k, symbol); __FUNCTION__,
ch_offset,
symbol_offset,
gNB->frame_parms.ofdm_symbol_size,
Ns,
k,
symbol);
#endif #endif
*/
switch (nushift) { switch (nushift) {
case 0: case 0:
fl = filt8_l0; fl = filt8_l0;
...@@ -124,9 +129,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -124,9 +129,9 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
//------------------generate DMRS------------------// //------------------generate DMRS------------------//
if (pusch_pdu->transform_precoding == transform_precoder_disabled) if (pusch_pdu->transform_precoding == transform_precoder_disabled) {
nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, (pusch_pdu->bwp_start + pusch_pdu->rb_start)*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type); nr_pusch_dmrs_rx(gNB, Ns, gNB->nr_gold_pusch_dmrs[pusch_pdu->scid][Ns][symbol], &pilot[0], 1000, 0, nb_rb_pusch, (pusch_pdu->bwp_start + pusch_pdu->rb_start)*NR_NB_SC_PER_RB, pusch_pdu->dmrs_config_type);
}
else { // if transform precoding or SC-FDMA is enabled in Uplink else { // if transform precoding or SC-FDMA is enabled in Uplink
// NR_SC_FDMA supports type1 DMRS so only 6 DMRS REs per RB possible // NR_SC_FDMA supports type1 DMRS so only 6 DMRS REs per RB possible
...@@ -151,11 +156,15 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -151,11 +156,15 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
//------------------------------------------------// //------------------------------------------------//
#ifdef DEBUG_PUSCH #ifdef DEBUG_PUSCH
for (int i=0;i<(6*nb_rb_pusch);i++) for (int i = 0; i < (6 * nb_rb_pusch); i++) {
printf("%d+j*(%d)\n",((int16_t*)pilot)[2*i],((int16_t*)pilot)[1+(2*i)]); LOG_I(PHY, "In %s: %d + j*(%d)\n",
__FUNCTION__,
((int16_t*)pilot)[2 * i],
((int16_t*)pilot)[1 + (2 * i)]);
}
#endif #endif
for (aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) { for (aarx=0; aarx<gNB->frame_parms.nb_antennas_rx; aarx++) {
re_offset = k; /* Initializing the Resource element offset for each Rx antenna */ re_offset = k; /* Initializing the Resource element offset for each Rx antenna */
...@@ -167,11 +176,11 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -167,11 +176,11 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
memset(ul_ch,0,4*(gNB->frame_parms.ofdm_symbol_size)); memset(ul_ch,0,4*(gNB->frame_parms.ofdm_symbol_size));
#ifdef DEBUG_PUSCH #ifdef DEBUG_PUSCH
printf("symbol_offset %d, nushift %d\n",symbol_offset,nushift); LOG_I(PHY, "In %s symbol_offset %d, nushift %d\n", __FUNCTION__, symbol_offset, nushift);
printf("ch est pilot addr %p RB_DL %d\n",&pilot[0], gNB->frame_parms.N_RB_UL); LOG_I(PHY, "In %s ch est pilot addr %p, N_RB_UL %d\n", __FUNCTION__, &pilot[0], gNB->frame_parms.N_RB_UL);
printf("bwp_start_subcarrier %d, k %d, first_carrier %d, nb_rb_pusch %d\n",bwp_start_subcarrier,k,gNB->frame_parms.first_carrier_offset,nb_rb_pusch); LOG_I(PHY, "In %s bwp_start_subcarrier %d, k %d, first_carrier %d, nb_rb_pusch %d\n", __FUNCTION__, bwp_start_subcarrier, k, gNB->frame_parms.first_carrier_offset, nb_rb_pusch);
printf("rxF addr %p p %d\n", rxF,p); LOG_I(PHY, "In %s rxF addr %p p %d\n", __FUNCTION__, rxF, p);
printf("ul_ch addr %p nushift %d\n",ul_ch,nushift); LOG_I(PHY, "In %s ul_ch addr %p nushift %d\n", __FUNCTION__, ul_ch, nushift);
#endif #endif
//if ((gNB->frame_parms.N_RB_UL&1)==0) { //if ((gNB->frame_parms.N_RB_UL&1)==0) {
...@@ -182,9 +191,18 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -182,9 +191,18 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PUSCH #ifdef DEBUG_PUSCH
printf("ch 0 %d\n",((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1])); LOG_I(PHY, "In %s ch 0 %d\n", __FUNCTION__, ((int32_t)pil[0]*rxF[0] - (int32_t)pil[1]*rxF[1]));
printf("pilot 0 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]); LOG_I(PHY, "In %s pilot 0 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",
printf("data 0 : rxF - > (%d,%d) (%d)\n",rxF[2],rxF[3],dBc(rxF[2],rxF[3])); __FUNCTION__,
rxF[0],
rxF[1],
dBc(rxF[0],rxF[1]),
ch[0],
ch[1],
dBc(ch[0],ch[1]),
pil[0],
pil[1]);
LOG_I(PHY, "In %s data 0 : rxF - > (%d,%d) (%d)\n", __FUNCTION__, rxF[2], rxF[3], dBc(rxF[2],rxF[3]));
#endif #endif
multadd_real_vector_complex_scalar(fl, multadd_real_vector_complex_scalar(fl,
...@@ -201,9 +219,23 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -201,9 +219,23 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PUSCH #ifdef DEBUG_PUSCH
printf("pilot 1 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]); LOG_I(PHY, "In %s pilot 1 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",
printf("data 1 : rxF - > (%d,%d) (%d)\n",rxF[2],rxF[3],dBc(rxF[2],rxF[3])); __FUNCTION__,
rxF[0],
rxF[1],
dBc(rxF[0],rxF[1]),
ch[0],
ch[1],
dBc(ch[0],ch[1]),
pil[0],
pil[1]);
LOG_I(PHY, "In %s data 1 : rxF - > (%d,%d) (%d)\n",
__FUNCTION__,
rxF[2],
rxF[3],
dBc(rxF[2],rxF[3]));
#endif #endif
multadd_real_vector_complex_scalar(fml, multadd_real_vector_complex_scalar(fml,
ch, ch,
ul_ch, ul_ch,
...@@ -217,9 +249,23 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, ...@@ -217,9 +249,23 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB,
ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15); ch[1] = (int16_t)(((int32_t)pil[0]*rxF[1] + (int32_t)pil[1]*rxF[0])>>15);
#ifdef DEBUG_PUSCH #ifdef DEBUG_PUSCH
printf("pilot 2 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",rxF[0],rxF[1],dBc(rxF[0],rxF[1]),ch[0],ch[1],dBc(ch[0],ch[1]),pil[0],pil[1]); LOG_I(PHY, "In %s pilot 2 : rxF - > (%d,%d) (%d) ch -> (%d,%d) (%d), pil -> (%d,%d) \n",
printf("data 2 : rxF - > (%d,%d) (%d)\n",rxF[2],rxF[3],dBc(rxF[2],rxF[3])); __FUNCTION__,
rxF[0],
rxF[1],
dBc(rxF[0],rxF[1]),
ch[0],
ch[1],
dBc(ch[0],ch[1]),
pil[0],
pil[1]);
LOG_I(PHY, "In %s data 2 : rxF - > (%d,%d) (%d)\n",
__FUNCTION__,
rxF[2],
rxF[3],
dBc(rxF[2],rxF[3]));
#endif #endif
multadd_real_vector_complex_scalar(fmm, multadd_real_vector_complex_scalar(fmm,
ch, ch,
ul_ch, ul_ch,
......
...@@ -681,7 +681,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, ...@@ -681,7 +681,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
preamble_shift -= NCS; preamble_shift -= NCS;
if (preamble_shift < 0) if (preamble_shift < 0)
preamble_shift+=((N_ZC/NCS)*NCS); preamble_shift+=N_ZC;
} }
} else { // This is the high-speed case } else { // This is the high-speed case
new_dft = 0; new_dft = 0;
......
...@@ -105,6 +105,8 @@ typedef struct { ...@@ -105,6 +105,8 @@ typedef struct {
uint8_t O_ACK; uint8_t O_ACK;
/// Index of current HARQ round for this ULSCH /// Index of current HARQ round for this ULSCH
uint8_t round; uint8_t round;
/// Last Ndi for this harq process
uint8_t ndi;
/// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8) /// pointer to pdu from MAC interface (TS 36.212 V15.4.0, Sec 5.1 p. 8)
unsigned char *a; unsigned char *a;
/// Pointer to the payload + CRC /// Pointer to the payload + CRC
......
...@@ -78,13 +78,15 @@ void nr_rf_card_config(openair0_config_t *openair0_cfg, ...@@ -78,13 +78,15 @@ void nr_rf_card_config(openair0_config_t *openair0_cfg,
openair0_cfg->autocal[i] = 1; openair0_cfg->autocal[i] = 1;
LOG_I(PHY, "HW: Configuring channel %d (rf_chain %d): setting tx_gain %f, rx_gain %f, tx_freq %f Hz, rx_freq %f Hz\n", if (i < openair0_cfg->rx_num_channels) {
i, LOG_I(PHY, "HW: Configuring channel %d (rf_chain %d): setting tx_gain %f, rx_gain %f, tx_freq %f Hz, rx_freq %f Hz\n",
rf_chain, i,
openair0_cfg->tx_gain[i], rf_chain,
openair0_cfg->rx_gain[i], openair0_cfg->tx_gain[i],
openair0_cfg->tx_freq[i], openair0_cfg->rx_gain[i],
openair0_cfg->rx_freq[i]); openair0_cfg->tx_freq[i],
openair0_cfg->rx_freq[i]);
}
} }
} }
\ No newline at end of file
...@@ -202,7 +202,6 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL, ...@@ -202,7 +202,6 @@ NR_UE_ULSCH_t *new_nr_ue_ulsch(uint16_t N_RB_UL,
for (i=0; i<number_of_harq_pids; i++) { for (i=0; i<number_of_harq_pids; i++) {
ulsch->harq_processes[i]->round=0; ulsch->harq_processes[i]->round=0;
} }
return(ulsch); return(ulsch);
} }
} }
...@@ -257,7 +256,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -257,7 +256,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
Ilbrm = 0; Ilbrm = 0;
Tbslbrm = 950984; //max tbs Tbslbrm = 950984; //max tbs
Coderate = 0.0; Coderate = 0.0;
harq_process->round = nr_rv_round_map_ue[harq_process->pusch_pdu.pusch_data.rv_index];
/////////// ///////////
///////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////
...@@ -267,8 +265,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -267,8 +265,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers); LOG_D(PHY,"ulsch coding nb_rb %d, Nl = %d\n", nb_rb, harq_process->pusch_pdu.nrOfLayers);
LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order); LOG_D(PHY,"ulsch coding A %d G %d mod_order %d\n", A,G, mod_order);
// if (harq_process->Ndi == 1) { // this is a new packet if (harq_process->ndi != harq_process->pusch_pdu.pusch_data.new_data_indicator) { // this is a new packet
if (harq_process->round == 0) { // this is a new packet
#ifdef DEBUG_ULSCH_CODING #ifdef DEBUG_ULSCH_CODING
printf("encoding thinks this is a new packet \n"); printf("encoding thinks this is a new packet \n");
#endif #endif
...@@ -415,7 +412,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, ...@@ -415,7 +412,7 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch,
/////////// ///////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
harq_process->ndi = harq_process->pusch_pdu.pusch_data.new_data_indicator;
} }
F = harq_process->F; F = harq_process->F;
Kr = harq_process->K; Kr = harq_process->K;
......
...@@ -497,13 +497,19 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, ...@@ -497,13 +497,19 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE,
int symb_offset = (slot%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot; int symb_offset = (slot%frame_parms->slots_per_subframe)*frame_parms->symbols_per_slot;
for(ap = 0; ap < Nl; ap++) { for(ap = 0; ap < Nl; ap++) {
for (int s=0;s<NR_NUMBER_OF_SYMBOLS_PER_SLOT;s++){ for (int s=0;s<NR_NUMBER_OF_SYMBOLS_PER_SLOT;s++){
LOG_D(PHY,"rotating txdataF symbol %d (%d) => (%d.%d)\n",
s,s+symb_offset,frame_parms->symbol_rotation[2*(s+symb_offset)],frame_parms->symbol_rotation[1+(2*(s+symb_offset))]); LOG_D(PHY,"In %s: rotating txdataF symbol %d (%d) => (%d.%d)\n",
rotate_cpx_vector((int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size*s], __FUNCTION__,
&frame_parms->symbol_rotation[2*(s+symb_offset)], s,
(int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size*s], s + symb_offset,
frame_parms->ofdm_symbol_size, frame_parms->symbol_rotation[1][2 * (s + symb_offset)],
15); frame_parms->symbol_rotation[1][1 + (2 * (s + symb_offset))]);
rotate_cpx_vector((int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size * s],
&frame_parms->symbol_rotation[1][2 * (s + symb_offset)],
(int16_t *)&txdataF[ap][frame_parms->ofdm_symbol_size * s],
frame_parms->ofdm_symbol_size,
15);
} }
} }
......
...@@ -280,30 +280,6 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in ...@@ -280,30 +280,6 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in
graph->iteration++; graph->iteration++;
} }
static void genericLogPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
float *values, *time;
oai_xygraph_getbuff(graph, &time, &values, len, 0);
for (int ant=0; ant<nb_ant; ant++) {
if (data[ant] != NULL) {
float *values, *time;
oai_xygraph_getbuff(graph, &time, &values, len, ant);
for (int i=0; i<len; i+=8) {
float *vals=values+i;
const scopeSample_t *in=&(data[ant][i]);
// TRY AUTOMATIC simd BY GCC
for (int k=0; k<8; k++ ) {
vals[k] = 10*log10(1.0+SquaredNorm(in[k]));
}
}
oai_xygraph(graph,time,values, len, ant, 10);
}
}
}
static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) { static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
float *values, *time; float *values, *time;
oai_xygraph_getbuff(graph, &time, &values, len, 0); oai_xygraph_getbuff(graph, &time, &values, len, 0);
......
...@@ -741,4 +741,10 @@ typedef struct RRU_config_s { ...@@ -741,4 +741,10 @@ typedef struct RRU_config_s {
MBSFN_config_t MBSFN_config[8]; MBSFN_config_t MBSFN_config[8];
} RRU_config_t; } RRU_config_t;
typedef struct processingData_RU {
int frame_tx;
int slot_tx;
openair0_timestamp timestamp_tx;
RU_t *ru;
} processingData_RU_t;
#endif //__PHY_DEFS_RU__H__ #endif //__PHY_DEFS_RU__H__
...@@ -831,6 +831,9 @@ typedef struct PHY_VARS_gNB_s { ...@@ -831,6 +831,9 @@ typedef struct PHY_VARS_gNB_s {
time_stats_t ulsch_freq_offset_estimation_stats; time_stats_t ulsch_freq_offset_estimation_stats;
*/ */
notifiedFIFO_t *respDecode; notifiedFIFO_t *respDecode;
notifiedFIFO_t *resp_L1;
notifiedFIFO_t *resp_L1_tx;
notifiedFIFO_t *resp_RU_tx;
tpool_t *threadPool; tpool_t *threadPool;
int nbDecode; int nbDecode;
uint8_t pusch_proc_threads; uint8_t pusch_proc_threads;
...@@ -872,4 +875,13 @@ union ldpcReqUnion { ...@@ -872,4 +875,13 @@ union ldpcReqUnion {
uint64_t p; uint64_t p;
}; };
typedef struct processingData_L1 {
int frame_rx;
int frame_tx;
int slot_rx;
int slot_tx;
openair0_timestamp timestamp_tx;
PHY_VARS_gNB *gNB;
} processingData_L1_t;
#endif #endif
...@@ -327,7 +327,8 @@ struct NR_DL_FRAME_PARMS { ...@@ -327,7 +327,8 @@ struct NR_DL_FRAME_PARMS {
/// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP) /// Cyclic Prefix for DL (0=Normal CP, 1=Extended CP)
lte_prefix_type_t Ncp; lte_prefix_type_t Ncp;
/// sequence which is computed based on carrier frequency and numerology to rotate/derotate each OFDM symbol according to Section 5.3 in 38.211 /// sequence which is computed based on carrier frequency and numerology to rotate/derotate each OFDM symbol according to Section 5.3 in 38.211
int16_t symbol_rotation[224*2]; /// First dimension is for the direction of the link (0 DL, 1 UL)
int16_t symbol_rotation[2][224*2];
/// shift of pilot position in one RB /// shift of pilot position in one RB
uint8_t nushift; uint8_t nushift;
/// SRS configuration from TS 38.331 RRC /// SRS configuration from TS 38.331 RRC
...@@ -368,20 +369,4 @@ struct NR_DL_FRAME_PARMS { ...@@ -368,20 +369,4 @@ struct NR_DL_FRAME_PARMS {
#define KHz (1000UL) #define KHz (1000UL)
#define MHz (1000*KHz) #define MHz (1000*KHz)
typedef struct nr_bandentry_s {
int16_t band;
uint64_t ul_min;
uint64_t ul_max;
uint64_t dl_min;
uint64_t dl_max;
uint64_t step_size;
uint64_t N_OFFs_DL;
uint8_t deltaf_raster;
} nr_bandentry_t;
typedef struct nr_band_info_s {
int nbands;
nr_bandentry_t band_info[100];
} nr_band_info_t;
#endif #endif
...@@ -542,6 +542,9 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -542,6 +542,9 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
} }
void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
/* those variables to log T_GNB_PHY_PUCCH_PUSCH_IQ only when we try to decode */
int pucch_decode_done = 0;
int pusch_decode_done = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,1); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,1);
LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx); LOG_D(PHY,"phy_procedures_gNB_uespec_RX frame %d, slot %d\n",frame_rx,slot_rx);
...@@ -563,6 +566,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -563,6 +566,8 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
(pucch->frame == frame_rx) && (pucch->frame == frame_rx) &&
(pucch->slot == slot_rx) ) { (pucch->slot == slot_rx) ) {
pucch_decode_done = 1;
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu; nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu;
uint16_t num_ucis; uint16_t num_ucis;
switch (pucch_pdu->format_type) { switch (pucch_pdu->format_type) {
...@@ -651,7 +656,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) ...@@ -651,7 +656,7 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
} }
#endif #endif
T(T_BENETEL, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], 2048*4*14)); pusch_decode_done = 1;
uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index; uint8_t symbol_start = ulsch_harq->ulsch_pdu.start_symbol_index;
uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols; uint8_t symbol_end = symbol_start + ulsch_harq->ulsch_pdu.nr_of_symbols;
...@@ -680,5 +685,9 @@ T(T_BENETEL, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF ...@@ -680,5 +685,9 @@ T(T_BENETEL, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF
// figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS // figure out a better way to choose slot_rx, 19 is ok for a particular TDD configuration with 30kHz SCS
if ((frame_rx&127) == 0 && slot_rx==19) dump_pusch_stats(gNB); if ((frame_rx&127) == 0 && slot_rx==19) dump_pusch_stats(gNB);
if (pucch_decode_done || pusch_decode_done) {
T(T_GNB_PHY_PUCCH_PUSCH_IQ, T_INT(frame_rx), T_INT(slot_rx), T_BUFFER(&gNB->common_vars.rxdataF[0][0], gNB->frame_parms.symbols_per_slot * gNB->frame_parms.ofdm_symbol_size * 4));
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_gNB_UESPEC_RX,0);
} }
...@@ -239,33 +239,15 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){ ...@@ -239,33 +239,15 @@ void ue_ta_procedures(PHY_VARS_NR_UE *ue, int slot_tx, int frame_tx){
int factor_mu = 1 << numerology; int factor_mu = 1 << numerology;
uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB); uint16_t bw_scaling = get_bw_scaling(bwp_ul_NB_RB);
LOG_D(PHY, "In %s: applying timing advance -- frame %d -- slot %d -- UE_mode %d\n", __FUNCTION__, frame_tx, slot_tx, ue->UE_mode[gNB_id]); ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling / factor_mu;
if (ue->UE_mode[gNB_id] == RA_RESPONSE){ LOG_I(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n",
__FUNCTION__,
ue->timing_advance = ul_time_alignment->ta_command * bw_scaling / factor_mu; ue->Mod_id,
frame_tx,
LOG_D(PHY, "In %s: [UE %d] [%d.%d] Received (RAR) timing advance command %d new value is %u \n", slot_tx,
__FUNCTION__, ul_time_alignment->ta_command,
ue->Mod_id, ue->timing_advance);
frame_tx,
slot_tx,
ul_time_alignment->ta_command,
ue->timing_advance);
} else if (ue->UE_mode[gNB_id] == PUSCH){
ue->timing_advance += (ul_time_alignment->ta_command - 31) * bw_scaling / factor_mu;
LOG_D(PHY, "In %s: [UE %d] [%d.%d] Got timing advance command %u from MAC, new value is %d\n",
__FUNCTION__,
ue->Mod_id,
frame_tx,
slot_tx,
ul_time_alignment->ta_command,
ue->timing_advance);
}
ul_time_alignment->ta_frame = -1; ul_time_alignment->ta_frame = -1;
ul_time_alignment->ta_slot = -1; ul_time_alignment->ta_slot = -1;
......
...@@ -79,8 +79,8 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; ...@@ -79,8 +79,8 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
double cpuf; double cpuf;
int sf_ahead=4 ; uint16_t sf_ahead=4 ;
int sl_ahead=0; uint16_t sl_ahead=0;
//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];
...@@ -262,7 +262,10 @@ int main(int argc, char **argv) ...@@ -262,7 +262,10 @@ int main(int argc, char **argv)
int i,aa;//,l; int i,aa;//,l;
double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0; double sigma2, sigma2_dB=10, SNR, snr0=-2.0, snr1=2.0;
uint8_t snr1set=0; uint8_t snr1set=0;
float roundStats[50]; double roundStats[500] = {0};
double blerStats[500] = {0};
double berStats[500] = {0};
double snrStats[500] = {0};
float effRate; float effRate;
//float psnr; //float psnr;
float eff_tp_check = 0.7; float eff_tp_check = 0.7;
...@@ -1128,7 +1131,9 @@ int main(int argc, char **argv) ...@@ -1128,7 +1131,9 @@ int main(int argc, char **argv)
if (UE_harq_process->harq_ack.ack==1) effRate += ((float)TBS)/round; if (UE_harq_process->harq_ack.ack==1) effRate += ((float)TBS)/round;
} // noise trials } // noise trials
blerStats[snrRun] = (float) n_errors / (float) n_trials;
roundStats[snrRun]/=((float)n_trials); roundStats[snrRun]/=((float)n_trials);
berStats[snrRun] = (double)errors_scrambling/available_bits/n_trials;
effRate /= n_trials; effRate /= n_trials;
printf("*****************************************\n"); printf("*****************************************\n");
printf("SNR %f, (false positive %f)\n", SNR, printf("SNR %f, (false positive %f)\n", SNR,
...@@ -1136,7 +1141,7 @@ int main(int argc, char **argv) ...@@ -1136,7 +1141,7 @@ int main(int argc, char **argv)
printf("*****************************************\n"); printf("*****************************************\n");
printf("\n"); printf("\n");
dump_pdsch_stats(gNB); dump_pdsch_stats(gNB);
printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],(double)errors_scrambling/available_bits/n_trials,effRate,effRate/TBS*100,TBS); printf("SNR %f : n_errors (negative CRC) = %d/%d, Avg round %.2f, Channel BER %e, BLER %.2f, Eff Rate %.4f bits/slot, Eff Throughput %.2f, TBS %u bits/slot\n", SNR, n_errors, n_trials,roundStats[snrRun],berStats[snrRun],blerStats[snrRun],effRate,effRate/TBS*100,TBS);
printf("\n"); printf("\n");
if (print_perf==1) { if (print_perf==1) {
...@@ -1201,15 +1206,19 @@ int main(int argc, char **argv) ...@@ -1201,15 +1206,19 @@ int main(int argc, char **argv)
break; break;
} }
//if ((float)n_errors/(float)n_trials <= target_error_rate) {
if (effRate > (eff_tp_check*TBS)) { if (effRate > (eff_tp_check*TBS)) {
printf("PDSCH test OK\n"); printf("PDSCH test OK\n");
break; break;
} }
snrStats[snrRun] = SNR;
snrRun++; snrRun++;
} // NSR } // NSR
LOG_M("dlsimStats.m","SNR",snrStats,snrRun,1,7);
LOG_MM("dlsimStats.m","BLER",blerStats,snrRun,1,7);
LOG_MM("dlsimStats.m","BER",berStats,snrRun,1,7);
LOG_MM("dlsimStats.m","rounds",roundStats,snrRun,1,7);
/*if (n_trials>1) { /*if (n_trials>1) {
printf("HARQ stats:\nSNR\tRounds\n"); printf("HARQ stats:\nSNR\tRounds\n");
psnr = snr0; psnr = snr0;
......
...@@ -111,7 +111,7 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, ...@@ -111,7 +111,7 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB,
nr_init_frame_parms(gNB_config, fp); nr_init_frame_parms(gNB_config, fp);
init_symbol_rotation(fp,fp->dl_CarrierFreq); init_symbol_rotation(fp);
gNB->configured = 1; gNB->configured = 1;
LOG_I(PHY,"gNB configured\n"); LOG_I(PHY,"gNB configured\n");
...@@ -540,7 +540,7 @@ int main(int argc, char **argv) ...@@ -540,7 +540,7 @@ int main(int argc, char **argv)
if (input_fd==NULL) { if (input_fd==NULL) {
gNB->pbch_configured = 1; gNB->pbch_configured = 1;
gNB->ssb_pdu.ssb_pdu_rel15.bchPayload = 0; gNB->ssb_pdu.ssb_pdu_rel15.bchPayload = 0x55dd33;
for (int slot=0;slot<frame_parms->slots_per_frame;slot++) { for (int slot=0;slot<frame_parms->slots_per_frame;slot++) {
for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++) for (aa=0; aa<gNB->frame_parms.nb_antennas_tx; aa++)
...@@ -718,9 +718,9 @@ int main(int argc, char **argv) ...@@ -718,9 +718,9 @@ int main(int argc, char **argv)
payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte); payload_ret = (UE->pbch_vars[0]->xtra_byte == gNB_xtra_byte);
for (i=0;i<3;i++){ for (i=0;i<3;i++){
payload_ret += (UE->pbch_vars[0]->decoded_output[i] == (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i))); payload_ret += (UE->pbch_vars[0]->decoded_output[i] == ((gNB->ssb_pdu.ssb_pdu_rel15.bchPayload>>(8*i)) & 0xff));
} }
//printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->rx_ind.rx_indication_body->mib_pdu.additional_bits); //printf("xtra byte gNB: 0x%02x UE: 0x%02x\n",gNB_xtra_byte, UE->pbch_vars[0]->xtra_byte);
//printf("ret %d\n", payload_ret); //printf("ret %d\n", payload_ret);
if (payload_ret!=4) if (payload_ret!=4)
n_errors_payload++; n_errors_payload++;
......
...@@ -65,7 +65,7 @@ double cpuf; ...@@ -65,7 +65,7 @@ double cpuf;
extern uint16_t prach_root_sequence_map0_3[838]; 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;
int sl_ahead = 0; uint16_t sl_ahead = 0;
//void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe); //void dump_nr_prach_config(NR_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
......
...@@ -75,9 +75,9 @@ PHY_VARS_NR_UE *UE; ...@@ -75,9 +75,9 @@ PHY_VARS_NR_UE *UE;
RAN_CONTEXT_t RC; RAN_CONTEXT_t RC;
int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int sf_ahead=4 ; uint16_t sf_ahead=4 ;
int slot_ahead=6 ; int slot_ahead=6 ;
int sl_ahead=0; uint16_t sl_ahead=0;
double cpuf; double cpuf;
//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];
......
...@@ -398,6 +398,11 @@ typedef struct s1ap_register_enb_req_s { ...@@ -398,6 +398,11 @@ typedef struct s1ap_register_enb_req_s {
/* Number of SCTP streams used for a mme association */ /* Number of SCTP streams used for a mme association */
uint16_t sctp_in_streams; uint16_t sctp_in_streams;
uint16_t sctp_out_streams; uint16_t sctp_out_streams;
uint16_t s1_setuprsp_wait_timer;
uint16_t s1_setupreq_wait_timer;
uint16_t s1_setupreq_count;
uint16_t sctp_req_timer;
uint16_t sctp_req_count;
} s1ap_register_enb_req_t; } s1ap_register_enb_req_t;
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
......
...@@ -2429,6 +2429,65 @@ int RCconfig_S1( ...@@ -2429,6 +2429,65 @@ int RCconfig_S1(
"to\n" "to\n"
" tracking_area_code = 1; // no string!!\n" " tracking_area_code = 1; // no string!!\n"
" plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n"); " plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } )\n");
if(*ENBParamList.paramarray[k][ENB_S1SETUP_RSP_TIMER_IDX].uptr <= 0xffff)
{
S1AP_REGISTER_ENB_REQ(msg_p).s1_setuprsp_wait_timer = *ENBParamList.paramarray[k][ENB_S1SETUP_RSP_TIMER_IDX].uptr;
}
else
{
LOG_E(S1AP,
"s1setup_rsp_timer value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_S1SETUP_RSP_TIMER_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).s1_setuprsp_wait_timer = 5;
}
if(*ENBParamList.paramarray[k][ENB_S1SETUP_REQ_TIMER_IDX].uptr <= 0xffff)
{
S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_wait_timer = *ENBParamList.paramarray[k][ENB_S1SETUP_REQ_TIMER_IDX].uptr;
}
else
{
LOG_E(S1AP,
"s1setup_req_timer value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_S1SETUP_REQ_TIMER_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_wait_timer = 5;
}
if(*ENBParamList.paramarray[k][ENB_S1SETUP_REQ_COUNT_IDX].uptr <= 0xffff)
{
S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_count = *ENBParamList.paramarray[k][ENB_S1SETUP_REQ_COUNT_IDX].uptr;
}
else
{
LOG_E(S1AP,
"s1setup_req_count value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_S1SETUP_REQ_COUNT_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).s1_setupreq_count = 0xffff;
}
if(*ENBParamList.paramarray[k][ENB_SCTP_REQ_TIMER_IDX].uptr <= 0xffff)
{
S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_timer = *ENBParamList.paramarray[k][ENB_SCTP_REQ_TIMER_IDX].uptr;
}
else
{
LOG_E(S1AP,
"sctp_req_timer value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_SCTP_REQ_TIMER_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_timer = 180;
}
if(*ENBParamList.paramarray[k][ENB_SCTP_REQ_COUNT_IDX].uptr <= 0xffff)
{
S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_count = *ENBParamList.paramarray[k][ENB_SCTP_REQ_COUNT_IDX].uptr;
}
else
{
LOG_E(S1AP,
"sctp_req_count value in conf file is invalid (%d). Default value is set.\n",
*ENBParamList.paramarray[k][ENB_SCTP_REQ_COUNT_IDX].uptr);
S1AP_REGISTER_ENB_REQ(msg_p).sctp_req_count = 0xffff;
}
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix); config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix);
if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6) { if (PLMNParamList.numelt < 1 || PLMNParamList.numelt > 6) {
......
...@@ -214,6 +214,11 @@ typedef enum { ...@@ -214,6 +214,11 @@ typedef enum {
#define ENB_CONFIG_STRING_X2 "enable_x2" #define ENB_CONFIG_STRING_X2 "enable_x2"
#define ENB_CONFIG_STRING_ENB_M2 "enable_enb_m2" #define ENB_CONFIG_STRING_ENB_M2 "enable_enb_m2"
#define ENB_CONFIG_STRING_MCE_M2 "enable_mce_m2" #define ENB_CONFIG_STRING_MCE_M2 "enable_mce_m2"
#define ENB_CONFIG_STRING_S1SETUP_RSP_TIMER "s1setup_rsp_timer"
#define ENB_CONFIG_STRING_S1SETUP_REQ_TIMER "s1setup_req_timer"
#define ENB_CONFIG_STRING_S1SETUP_REQ_COUNT "s1setup_req_count"
#define ENB_CONFIG_STRING_SCTP_REQ_TIMER "sctp_req_timer"
#define ENB_CONFIG_STRING_SCTP_REQ_COUNT "sctp_req_count"
/*-----------------------------------------------------------------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------------------------------------------------------------*/
/* cell configuration parameters */ /* cell configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */ /* optname helpstr paramflags XXXptr defXXXval type numelt */
...@@ -239,6 +244,11 @@ typedef enum { ...@@ -239,6 +244,11 @@ typedef enum {
{ENB_CONFIG_STRING_X2, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_X2, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_ENB_M2, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_ENB_M2, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_MCE_M2, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \ {ENB_CONFIG_STRING_MCE_M2, NULL, 0, strptr:NULL, defstrval:"no", TYPE_STRING, 0}, \
{ENB_CONFIG_STRING_S1SETUP_RSP_TIMER, NULL, 0, uptr:NULL, defuintval:5, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_S1SETUP_REQ_TIMER, NULL, 0, uptr:NULL, defuintval:5, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_S1SETUP_REQ_COUNT, NULL, 0, uptr:NULL, defuintval:65535, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_SCTP_REQ_TIMER, NULL, 0, uptr:NULL, defuintval:180, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_SCTP_REQ_COUNT, NULL, 0, uptr:NULL, defuintval:65535, TYPE_UINT, 0}, \
} }
#define ENB_ENB_ID_IDX 0 #define ENB_ENB_ID_IDX 0
...@@ -261,6 +271,11 @@ typedef enum { ...@@ -261,6 +271,11 @@ typedef enum {
#define ENB_ENABLE_X2 17 #define ENB_ENABLE_X2 17
#define ENB_ENABLE_ENB_M2 18 #define ENB_ENABLE_ENB_M2 18
#define ENB_ENABLE_MCE_M2 19 #define ENB_ENABLE_MCE_M2 19
#define ENB_S1SETUP_RSP_TIMER_IDX 20
#define ENB_S1SETUP_REQ_TIMER_IDX 21
#define ENB_S1SETUP_REQ_COUNT_IDX 22
#define ENB_SCTP_REQ_TIMER_IDX 23
#define ENB_SCTP_REQ_COUNT_IDX 24
#define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD} #define TRACKING_AREA_CODE_OKRANGE {0x0001,0xFFFD}
#define ENBPARAMS_CHECK { \ #define ENBPARAMS_CHECK { \
......
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band); uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
void get_frame_type(uint16_t nr_bandP, uint8_t scs_index, lte_frame_type_t *current_type); lte_frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index);
void get_delta_duplex(int nr_bandP, uint8_t scs_index, int32_t *delta_duplex); int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index);
uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn);
...@@ -51,7 +51,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i ...@@ -51,7 +51,7 @@ int16_t fill_dmrs_mask(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,i
int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP); int is_nr_DL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP);
int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc,slot_t slotP); int is_nr_UL_slot(NR_ServingCellConfigCommon_t *scc, slot_t slotP, lte_frame_type_t frame_type);
uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc, uint16_t nr_dci_size(const NR_ServingCellConfigCommon_t *scc,
const NR_CellGroupConfig_t *secondaryCellGroup, const NR_CellGroupConfig_t *secondaryCellGroup,
...@@ -140,7 +140,6 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, ...@@ -140,7 +140,6 @@ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config,
uint8_t *K_ptrs, uint8_t *L_ptrs,uint8_t *portIndex, uint8_t *K_ptrs, uint8_t *L_ptrs,uint8_t *portIndex,
uint8_t *nERatio,uint8_t *reOffset, uint8_t *nERatio,uint8_t *reOffset,
uint8_t NrOfSymbols); uint8_t NrOfSymbols);
void get_band(uint64_t downlink_frequency, uint16_t *current_band, int32_t *current_offset, lte_frame_type_t *current_type);
uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol); uint8_t get_num_dmrs_symbols(NR_PDSCH_Config_t *pdsch_Config,int dmrs_TypeA_Position,int NrOfSymbols,int startSymbol);
......
...@@ -203,13 +203,12 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -203,13 +203,12 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
frequency_range_t frequency_range = band<100?FR1:FR2; frequency_range_t frequency_range = band<100?FR1:FR2;
lte_frame_type_t frame_type; mac->frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing, &frame_type);
// cell config // cell config
cfg->cell_config.phy_cell_id = *scc->physCellId; cfg->cell_config.phy_cell_id = *scc->physCellId;
cfg->cell_config.frame_duplex_type = frame_type; cfg->cell_config.frame_duplex_type = mac->frame_type;
// SSB config // SSB config
cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower; cfg->ssb_config.ss_pbch_power = scc->ss_PBCH_BlockPower;
...@@ -313,7 +312,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac, ...@@ -313,7 +312,7 @@ void config_common_ue(NR_UE_MAC_INST_t *mac,
cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart; cfg->prach_config.num_prach_fd_occasions_list[i].k1 = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.msg1_FrequencyStart;
cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig; cfg->prach_config.num_prach_fd_occasions_list[i].prach_zero_corr_conf = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.zeroCorrelationZoneConfig;
cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, frame_type,frequency_range); cfg->prach_config.num_prach_fd_occasions_list[i].num_root_sequences = compute_nr_root_seq(scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup, nb_preambles, mac->frame_type, frequency_range);
//cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ??? //cfg->prach_config.num_prach_fd_occasions_list[i].num_unused_root_sequences = ???
} }
......
...@@ -332,6 +332,8 @@ typedef struct { ...@@ -332,6 +332,8 @@ typedef struct {
NR_ControlResourceSet_t *coreset[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP]; NR_ControlResourceSet_t *coreset[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP];
NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP][FAPI_NR_MAX_SS_PER_CORESET]; NR_SearchSpace_t *SSpace[MAX_NUM_BWP][FAPI_NR_MAX_CORESET_PER_BWP][FAPI_NR_MAX_SS_PER_CORESET];
lte_frame_type_t frame_type;
/*BWP*/ /*BWP*/
// dedicated active DL BWP // dedicated active DL BWP
NR_BWP_Id_t DL_BWP_Id; NR_BWP_Id_t DL_BWP_Id;
......
...@@ -2317,7 +2317,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t ...@@ -2317,7 +2317,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
// TA command // TA command
ul_time_alignment->apply_ta = 1; ul_time_alignment->apply_ta = 1;
ul_time_alignment->ta_command = rar->TA2 + (rar->TA1 << 5); ul_time_alignment->ta_command = 31 + rar->TA2 + (rar->TA1 << 5);
#ifdef DEBUG_RAR #ifdef DEBUG_RAR
// CSI // CSI
......
...@@ -118,13 +118,14 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) { ...@@ -118,13 +118,14 @@ long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
* This function returns the UL config corresponding to a given UL slot * This function returns the UL config corresponding to a given UL slot
* from MAC instance . * from MAC instance .
*/ */
fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot) { fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int slot)
{
//Check if request to access ul_config is for a UL slot //Check if request to access ul_config is for a UL slot
if (is_nr_UL_slot(mac->scc, slot) == 0) { if (is_nr_UL_slot(mac->scc, slot, mac->frame_type) == 0) {
LOG_W(MAC, "Slot %d is not a UL slot. %s called for wrong slot!!!\n", slot, __FUNCTION__); LOG_W(MAC, "Slot %d is not a UL slot. %s called for wrong slot!!!\n", slot, __FUNCTION__);
return NULL; return NULL;
} }
// Calculate the index of the UL slot in mac->ul_config_request list. This is // Calculate the index of the UL slot in mac->ul_config_request list. This is
// based on the TDD pattern (slot configuration period) and number of UL+mixed // based on the TDD pattern (slot configuration period) and number of UL+mixed
// slots in the period. TS 38.213 Sec 11.1 // slots in the period. TS 38.213 Sec 11.1
...@@ -1671,7 +1672,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1671,7 +1672,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
ra->RA_offset = 2; // to compensate the rx frame offset at the gNB ra->RA_offset = 2; // to compensate the rx frame offset at the gNB
ra->generate_nr_prach = GENERATE_IDLE; // Reset flag for PRACH generation ra->generate_nr_prach = GENERATE_IDLE; // Reset flag for PRACH generation
if (is_nr_UL_slot(scc, slotP)) { if (is_nr_UL_slot(scc, slotP, mac->frame_type)) {
// WIP Need to get the proper selected ssb_idx // WIP Need to get the proper selected ssb_idx
// Initial beam selection functionality is not available yet // Initial beam selection functionality is not available yet
...@@ -1692,13 +1693,11 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1692,13 +1693,11 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
format0 = format & 0xff; // single PRACH format format0 = format & 0xff; // single PRACH format
format1 = (format >> 8) & 0xff; // dual PRACH format format1 = (format >> 8) & 0xff; // dual PRACH format
ul_config->sfn = frameP;
ul_config->slot = slotP;
ul_config->ul_config_list[ul_config->number_pdus].pdu_type = FAPI_NR_UL_CONFIG_TYPE_PRACH;
prach_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu; prach_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu;
memset(prach_config_pdu, 0, sizeof(fapi_nr_ul_config_prach_pdu)); memset(prach_config_pdu, 0, sizeof(fapi_nr_ul_config_prach_pdu));
ul_config->number_pdus += 1;
fill_ul_config(ul_config, frameP, slotP, FAPI_NR_UL_CONFIG_TYPE_PRACH);
LOG_D(PHY, "In %s: (%p) %d UL PDUs:\n", __FUNCTION__, ul_config, ul_config->number_pdus); LOG_D(PHY, "In %s: (%p) %d UL PDUs:\n", __FUNCTION__, ul_config, ul_config->number_pdus);
ncs = get_NCS(rach_ConfigGeneric->zeroCorrelationZoneConfig, format0, setup->restrictedSetConfig); ncs = get_NCS(rach_ConfigGeneric->zeroCorrelationZoneConfig, format0, setup->restrictedSetConfig);
...@@ -1776,11 +1775,10 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -1776,11 +1775,10 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
AssertFatal(1 == 0, "Invalid PRACH format"); AssertFatal(1 == 0, "Invalid PRACH format");
} }
} // if format1 } // if format1
fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id);
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
mac->if_module->scheduled_response(&scheduled_response);
} // is_nr_prach_slot } // is_nr_prach_slot
fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id);
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
mac->if_module->scheduled_response(&scheduled_response);
} // if is_nr_UL_slot } // if is_nr_UL_slot
} }
......
...@@ -127,8 +127,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm ...@@ -127,8 +127,7 @@ void config_common(int Mod_idP, int pdsch_AntennaPorts, NR_ServingCellConfigComm
uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; uint32_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0];
frequency_range_t frequency_range = band<100?FR1:FR2; frequency_range_t frequency_range = band<100?FR1:FR2;
lte_frame_type_t frame_type; lte_frame_type_t frame_type = get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing);
get_frame_type(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing, &frame_type);
RC.nrmac[Mod_idP]->common_channels[0].frame_type = frame_type; RC.nrmac[Mod_idP]->common_channels[0].frame_type = frame_type;
// Cell configuration // Cell configuration
......
...@@ -364,7 +364,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -364,7 +364,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
/* send tick to RLC and RRC every ms */ /* send tick to RLC and RRC every ms */
if ((slot & ((1 << *scc->ssbSubcarrierSpacing) - 1)) == 0) { if ((slot & ((1 << *scc->ssbSubcarrierSpacing) - 1)) == 0) {
void nr_rlc_tick(int frame, int subframe); void nr_rlc_tick(int frame, int subframe);
void nr_pdcp_tick(int frame, int subframe);
nr_rlc_tick(frame, slot >> *scc->ssbSubcarrierSpacing); nr_rlc_tick(frame, slot >> *scc->ssbSubcarrierSpacing);
nr_pdcp_tick(frame, slot >> *scc->ssbSubcarrierSpacing);
nr_rrc_trigger(&ctxt, 0 /*CC_id*/, frame, slot >> *scc->ssbSubcarrierSpacing); nr_rrc_trigger(&ctxt, 0 /*CC_id*/, frame, slot >> *scc->ssbSubcarrierSpacing);
} }
......
...@@ -245,7 +245,8 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP ...@@ -245,7 +245,8 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, sub_frame_t slotP
nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[0][slotP]; nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[0][slotP];
nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0]; nfapi_nr_config_request_scf_t *cfg = &RC.nrmac[module_idP]->config[0];
if (is_nr_UL_slot(scc,slotP)) { if (is_nr_UL_slot(scc, slotP, cc->frame_type)) {
uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex; uint8_t config_index = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.prach_ConfigurationIndex;
uint8_t mu,N_dur,N_t_slot,start_symbol = 0,N_RA_slot; uint8_t mu,N_dur,N_t_slot,start_symbol = 0,N_RA_slot;
uint16_t RA_sfn_index = -1; uint16_t RA_sfn_index = -1;
......
...@@ -21,24 +21,222 @@ ...@@ -21,24 +21,222 @@
#include "nr_pdcp_entity.h" #include "nr_pdcp_entity.h"
#include "nr_pdcp_entity_drb_am.h" #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "nr_pdcp_security_nea2.h" #include "nr_pdcp_security_nea2.h"
#include "nr_pdcp_sdu.h"
#include "LOG/log.h" #include "LOG/log.h"
nr_pdcp_entity_t *new_nr_pdcp_entity_srb( static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity,
int is_gnb, int rb_id, char *_buffer, int size)
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
char *buf, int size),
void *deliver_sdu_data,
void (*deliver_pdu)(void *deliver_pdu_data, struct nr_pdcp_entity_t *entity,
char *buf, int size, int sdu_id),
void *deliver_pdu_data)
{ {
abort(); unsigned char *buffer = (unsigned char *)_buffer;
nr_pdcp_sdu_t *sdu;
int rcvd_sn;
uint32_t rcvd_hfn;
uint32_t rcvd_count;
int header_size;
int integrity_size;
int rx_deliv_sn;
uint32_t rx_deliv_hfn;
if (size < 1) {
LOG_E(PDCP, "bad PDU received (size = %d)\n", size);
return;
}
if (!(buffer[0] & 0x80)) {
LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if (entity->sn_size == 12) {
rcvd_sn = (((unsigned char)buffer[0] & 0xf) << 8) |
(unsigned char)buffer[1];
header_size = 2;
} else {
rcvd_sn = (((unsigned char)buffer[0] & 0x3) << 16) |
((unsigned char)buffer[1] << 8) |
(unsigned char)buffer[2];
header_size = 3;
}
integrity_size = 0;
if (size < header_size + integrity_size + 1) {
LOG_E(PDCP, "bad PDU received (size = %d)\n", size);
return;
}
rx_deliv_sn = entity->rx_deliv & entity->sn_max;
rx_deliv_hfn = (entity->rx_deliv >> entity->sn_size) & ~entity->sn_max;
if (rcvd_sn < rx_deliv_sn - entity->window_size) {
rcvd_hfn = rx_deliv_hfn + 1;
} else if (rcvd_sn >= rx_deliv_sn + entity->window_size) {
rcvd_hfn = rx_deliv_hfn - 1;
} else {
rcvd_hfn = rx_deliv_hfn;
}
rcvd_count = (rcvd_hfn << entity->sn_size) | rcvd_sn;
if (entity->has_ciphering)
entity->cipher(entity->security_context,
(unsigned char *)buffer+header_size, size-header_size,
entity->rb_id, rcvd_count, entity->is_gnb ? 0 : 1);
if (rcvd_count < entity->rx_deliv
|| nr_pdcp_sdu_in_list(entity->rx_list, rcvd_count)) {
LOG_D(PDCP, "discard NR PDU rcvd_count=%d\n", rcvd_count);
return;
}
sdu = nr_pdcp_new_sdu(rcvd_count,
(char *)buffer + header_size,
size - header_size - integrity_size);
entity->rx_list = nr_pdcp_sdu_list_add(entity->rx_list, sdu);
entity->rx_size += size-header_size;
if (rcvd_count >= entity->rx_next) {
entity->rx_next = rcvd_count + 1;
}
/* TODO(?): out of order delivery */
if (rcvd_count == entity->rx_deliv) {
/* deliver all SDUs starting from rx_deliv up to discontinuity or end of list */
uint32_t count = entity->rx_deliv;
while (entity->rx_list != NULL && count == entity->rx_list->count) {
nr_pdcp_sdu_t *cur = entity->rx_list;
entity->deliver_sdu(entity->deliver_sdu_data, entity,
cur->buffer, cur->size);
entity->rx_list = cur->next;
entity->rx_size -= cur->size;
nr_pdcp_free_sdu(cur);
count++;
}
entity->rx_deliv = count;
}
if (entity->t_reordering_start != 0 && entity->rx_deliv > entity->rx_reord) {
/* stop and reset t-Reordering */
entity->t_reordering_start = 0;
}
if (entity->t_reordering_start == 0 && entity->rx_deliv < entity->rx_next) {
entity->rx_reord = entity->rx_next;
entity->t_reordering_start = entity->t_current;
}
} }
nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am( static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity,
char *buffer, int size, int sdu_id)
{
uint32_t count;
int sn;
int header_size;
char buf[size+3+4];
count = entity->tx_next;
sn = entity->tx_next & entity->sn_max;
if (entity->sn_size == 12) {
buf[0] = 0x80 | ((sn >> 8) & 0xf);
buf[1] = sn & 0xff;
header_size = 2;
} else {
buf[0] = 0x80 | ((sn >> 16) & 0x3);
buf[1] = (sn >> 8) & 0xff;
buf[2] = sn & 0xff;
header_size = 3;
}
memcpy(buf+header_size, buffer, size);
if (entity->has_ciphering)
entity->cipher(entity->security_context,
(unsigned char *)buf+header_size, size,
entity->rb_id, count, entity->is_gnb ? 1 : 0);
entity->tx_next++;
entity->deliver_pdu(entity->deliver_pdu_data, entity, buf,
size+header_size, sdu_id);
}
static void nr_pdcp_entity_set_integrity_key(nr_pdcp_entity_t *entity,
char *key)
{
memcpy(entity->integrity_key, key, 16);
}
static void check_t_reordering(nr_pdcp_entity_t *entity)
{
uint32_t count;
if (entity->t_reordering_start == 0
|| entity->t_current <= entity->t_reordering_start + entity->t_reordering)
return;
/* stop timer */
entity->t_reordering_start = 0;
/* deliver all SDUs with count < rx_reord */
while (entity->rx_list != NULL && entity->rx_list->count < entity->rx_reord) {
nr_pdcp_sdu_t *cur = entity->rx_list;
entity->deliver_sdu(entity->deliver_sdu_data, entity,
cur->buffer, cur->size);
entity->rx_list = cur->next;
entity->rx_size -= cur->size;
nr_pdcp_free_sdu(cur);
}
/* deliver all SDUs starting from rx_reord up to discontinuity or end of list */
count = entity->rx_reord;
while (entity->rx_list != NULL && count == entity->rx_list->count) {
nr_pdcp_sdu_t *cur = entity->rx_list;
entity->deliver_sdu(entity->deliver_sdu_data, entity,
cur->buffer, cur->size);
entity->rx_list = cur->next;
entity->rx_size -= cur->size;
nr_pdcp_free_sdu(cur);
count++;
}
entity->rx_deliv = count;
if (entity->rx_deliv < entity->rx_next) {
entity->rx_reord = entity->rx_next;
entity->t_reordering_start = entity->t_current;
}
}
void nr_pdcp_entity_set_time(struct nr_pdcp_entity_t *entity, uint64_t now)
{
entity->t_current = now;
check_t_reordering(entity);
}
void nr_pdcp_entity_delete(nr_pdcp_entity_t *entity)
{
nr_pdcp_sdu_t *cur = entity->rx_list;
while (cur != NULL) {
nr_pdcp_sdu_t *next = cur->next;
nr_pdcp_free_sdu(cur);
cur = next;
}
if (entity->free_security != NULL)
entity->free_security(entity->security_context);
free(entity);
}
nr_pdcp_entity_t *new_nr_pdcp_entity(
nr_pdcp_entity_type_t type,
int is_gnb, int rb_id, int is_gnb, int rb_id,
void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity, void (*deliver_sdu)(void *deliver_sdu_data, struct nr_pdcp_entity_t *entity,
char *buf, int size), char *buf, int size),
...@@ -54,52 +252,56 @@ nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am( ...@@ -54,52 +252,56 @@ nr_pdcp_entity_t *new_nr_pdcp_entity_drb_am(
unsigned char *ciphering_key, unsigned char *ciphering_key,
unsigned char *integrity_key) unsigned char *integrity_key)
{ {
nr_pdcp_entity_drb_am_t *ret; nr_pdcp_entity_t *ret;
ret = calloc(1, sizeof(nr_pdcp_entity_drb_am_t)); ret = calloc(1, sizeof(nr_pdcp_entity_t));
if (ret == NULL) { if (ret == NULL) {
LOG_E(PDCP, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__); LOG_E(PDCP, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
exit(1); exit(1);
} }
ret->common.recv_pdu = nr_pdcp_entity_drb_am_recv_pdu; ret->type = type;
ret->common.recv_sdu = nr_pdcp_entity_drb_am_recv_sdu;
ret->common.set_integrity_key = nr_pdcp_entity_drb_am_set_integrity_key; ret->recv_pdu = nr_pdcp_entity_recv_pdu;
ret->recv_sdu = nr_pdcp_entity_recv_sdu;
ret->set_integrity_key = nr_pdcp_entity_set_integrity_key;
ret->set_time = nr_pdcp_entity_set_time;
ret->common.delete = nr_pdcp_entity_drb_am_delete; ret->delete = nr_pdcp_entity_delete;
ret->common.deliver_sdu = deliver_sdu; ret->deliver_sdu = deliver_sdu;
ret->common.deliver_sdu_data = deliver_sdu_data; ret->deliver_sdu_data = deliver_sdu_data;
ret->common.deliver_pdu = deliver_pdu; ret->deliver_pdu = deliver_pdu;
ret->common.deliver_pdu_data = deliver_pdu_data; ret->deliver_pdu_data = deliver_pdu_data;
ret->rb_id = rb_id; ret->rb_id = rb_id;
ret->sn_size = sn_size; ret->sn_size = sn_size;
ret->t_reordering = t_reordering; ret->t_reordering = t_reordering;
ret->discard_timer = discard_timer; ret->discard_timer = discard_timer;
ret->common.maximum_nr_pdcp_sn = (1 << sn_size) - 1; ret->sn_max = (1 << sn_size) - 1;
ret->window_size = 1 << (sn_size - 1);
if (ciphering_key != NULL && ciphering_algorithm != 0) { if (ciphering_key != NULL && ciphering_algorithm != 0) {
if (ciphering_algorithm != 2) { if (ciphering_algorithm != 2) {
LOG_E(PDCP, "FATAL: only nea2 supported for the moment\n"); LOG_E(PDCP, "FATAL: only nea2 supported for the moment\n");
exit(1); exit(1);
} }
ret->common.has_ciphering = 1; ret->has_ciphering = 1;
ret->common.ciphering_algorithm = ciphering_algorithm; ret->ciphering_algorithm = ciphering_algorithm;
memcpy(ret->common.ciphering_key, ciphering_key, 16); memcpy(ret->ciphering_key, ciphering_key, 16);
ret->common.security_context = nr_pdcp_security_nea2_init(ciphering_key); ret->security_context = nr_pdcp_security_nea2_init(ciphering_key);
ret->common.cipher = nr_pdcp_security_nea2_cipher; ret->cipher = nr_pdcp_security_nea2_cipher;
ret->common.free_security = nr_pdcp_security_nea2_free_security; ret->free_security = nr_pdcp_security_nea2_free_security;
} }
ret->common.is_gnb = is_gnb; ret->is_gnb = is_gnb;
if (integrity_key != NULL) { if (integrity_key != NULL) {
printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__); printf("%s:%d:%s: TODO\n", __FILE__, __LINE__, __FUNCTION__);
exit(1); exit(1);
} }
return (nr_pdcp_entity_t *)ret; return ret;
} }
This diff is collapsed.
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#endif #endif
#include "asn1_utils.h" #include "asn1_utils.h"
#include "nr_pdcp_ue_manager.h" #include "nr_pdcp_ue_manager.h"
#include "nr_pdcp_timer_thread.h"
#include "NR_RadioBearerConfig.h" #include "NR_RadioBearerConfig.h"
#include "NR_RLC-BearerConfig.h" #include "NR_RLC-BearerConfig.h"
#include "NR_RLC-Config.h" #include "NR_RLC-Config.h"
...@@ -41,6 +42,11 @@ ...@@ -41,6 +42,11 @@
static nr_pdcp_ue_manager_t *nr_pdcp_ue_manager; static nr_pdcp_ue_manager_t *nr_pdcp_ue_manager;
/* TODO: handle time a bit more properly */
static uint64_t nr_pdcp_current_time;
static int nr_pdcp_current_time_last_frame;
static int nr_pdcp_current_time_last_subframe;
/* necessary globals for OAI, not used internally */ /* necessary globals for OAI, not used internally */
hash_table_t *pdcp_coll_p; hash_table_t *pdcp_coll_p;
static uint64_t pdcp_optmask; static uint64_t pdcp_optmask;
...@@ -339,6 +345,8 @@ void pdcp_layer_init(void) ...@@ -339,6 +345,8 @@ void pdcp_layer_init(void)
nr_pdcp_ue_manager = new_nr_pdcp_ue_manager(1); nr_pdcp_ue_manager = new_nr_pdcp_ue_manager(1);
init_nr_rlc_data_req_queue(); init_nr_rlc_data_req_queue();
nr_pdcp_init_timer_thread(nr_pdcp_ue_manager);
} }
#include "nfapi/oai_integration/vendor_ext.h" #include "nfapi/oai_integration/vendor_ext.h"
...@@ -625,11 +633,11 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s, ...@@ -625,11 +633,11 @@ static void add_drb_am(int is_gnb, int rnti, struct NR_DRB_ToAddMod *s,
LOG_D(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n", LOG_D(PDCP, "%s:%d:%s: warning DRB %d already exist for ue %d, do nothing\n",
__FILE__, __LINE__, __FUNCTION__, drb_id, rnti); __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
} else { } else {
pdcp_drb = new_nr_pdcp_entity_drb_am(is_gnb, drb_id, pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id,
deliver_sdu_drb, ue, deliver_pdu_drb, ue, deliver_sdu_drb, ue, deliver_pdu_drb, ue,
sn_size_dl, t_reordering, discard_timer, sn_size_dl, t_reordering, discard_timer,
ciphering_algorithm, integrity_algorithm, ciphering_algorithm, integrity_algorithm,
ciphering_key, integrity_key); ciphering_key, integrity_key);
nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb); nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb);
LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); LOG_D(PDCP, "%s:%d:%s: added drb %d to ue rnti %x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti);
...@@ -978,3 +986,14 @@ void ...@@ -978,3 +986,14 @@ void
pdcp_mbms_run ( const protocol_ctxt_t *const ctxt_pP){ pdcp_mbms_run ( const protocol_ctxt_t *const ctxt_pP){
/* nothing to do */ /* nothing to do */
} }
void nr_pdcp_tick(int frame, int subframe)
{
if (frame != nr_pdcp_current_time_last_frame ||
subframe != nr_pdcp_current_time_last_subframe) {
nr_pdcp_current_time_last_frame = frame;
nr_pdcp_current_time_last_subframe = subframe;
nr_pdcp_current_time++;
nr_pdcp_wakeup_timer_thread(nr_pdcp_current_time);
}
}
This diff is collapsed.
This diff is collapsed.
...@@ -189,6 +189,20 @@ void nr_pdcp_ue_add_drb_pdcp_entity(nr_pdcp_ue_t *ue, int drb_id, nr_pdcp_entity ...@@ -189,6 +189,20 @@ void nr_pdcp_ue_add_drb_pdcp_entity(nr_pdcp_ue_t *ue, int drb_id, nr_pdcp_entity
ue->drb[drb_id] = entity; ue->drb[drb_id] = entity;
} }
/* must be called with lock acquired */
nr_pdcp_ue_t **nr_pdcp_manager_get_ue_list(nr_pdcp_ue_manager_t *_m)
{
nr_pdcp_ue_manager_internal_t *m = _m;
return m->ue_list;
}
/* must be called with lock acquired */
int nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager_t *_m)
{
nr_pdcp_ue_manager_internal_t *m = _m;
return m->ue_count;
}
int nr_pdcp_get_first_rnti(nr_pdcp_ue_manager_t *_m) int nr_pdcp_get_first_rnti(nr_pdcp_ue_manager_t *_m)
{ {
nr_pdcp_ue_manager_internal_t *m = _m; nr_pdcp_ue_manager_internal_t *m = _m;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -190,7 +190,6 @@ int decode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint ...@@ -190,7 +190,6 @@ int decode_attach_accept(attach_accept_msg *attach_accept, uint8_t *buffer, uint
default: default:
errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI; errorCodeDecoder = TLV_DECODE_UNEXPECTED_IEI;
LOG_TRACE(WARNING, "DECODE_UNEXPECTED_IEI %x (4 bits)", ieiDecoded); LOG_TRACE(WARNING, "DECODE_UNEXPECTED_IEI %x (4 bits)", ieiDecoded);
AssertFatal(0, " ");
return TLV_DECODE_UNEXPECTED_IEI; return TLV_DECODE_UNEXPECTED_IEI;
} }
} }
......
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