Merge remote-tracking branch 'origin/develop' into NR_RRCConfiguration_FR2

This commit is contained in:
Florian Kaltenberger
2020-11-03 16:55:20 +01:00
164 changed files with 9945 additions and 5976 deletions
+8
View File
@@ -0,0 +1,8 @@
*.log
cmake_targets/log/
cmake_targets/ran_build/
common/utils/T/T_IDs.h
common/utils/T/T_messages.txt.h
common/utils/T/genids
common/utils/T/genids.o
targets/bin/
+39 -3
View File
@@ -35,6 +35,9 @@ def doFlexranCtrlTest = false
// Location of the executor node
def nodeExecutor = params.nodeExecutor
// VM Lockable resources
def vmResource = params.vmLockableResource
pipeline {
agent {
label nodeExecutor
@@ -159,65 +162,81 @@ pipeline {
stage ("Start VM -- basic-sim") {
steps {
lock (vmResource) {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
}
stage ("Start VM -- gnb-usrp") {
steps {
lock (vmResource) {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
}
stage ("Start VM -- nr-ue-usrp") {
steps {
lock (vmResource) {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant nr-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
}
stage ("Start VM -- enb-usrp") {
steps {
lock (vmResource) {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
}
stage ("Start VM -- phy-sim") {
steps {
lock (vmResource) {
timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
}
stage ("Start VM -- enb-ethernet") {
steps {
timeout (time: 5, unit: 'MINUTES') {
lock (vmResource) {
timeout (time: 7, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
}
stage ("Start VM -- ue-ethernet") {
steps {
timeout (time: 5, unit: 'MINUTES') {
lock (vmResource) {
timeout (time: 7, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
}
stage ("Start VM -- cppcheck") {
steps {
timeout (time: 5, unit: 'MINUTES') {
lock (vmResource) {
timeout (time: 7, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
}
@@ -288,11 +307,14 @@ pipeline {
}
stage ("Build UE-ethernet") {
steps {
// This is typically the last one to finish.
lock (vmResource) {
gitlabCommitStatus(name: "Build UE-ethernet") {
timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
}
}
}
@@ -354,6 +376,7 @@ pipeline {
stages {
stage ("Test physical simulators") {
steps {
lock (vmResource) {
script {
timeout (time: 90, unit: 'MINUTES') {
try {
@@ -365,6 +388,7 @@ pipeline {
}
}
}
}
}
}
stage ("Build Flexran Controller") {
@@ -372,6 +396,7 @@ pipeline {
expression {doFlexranCtrlTest}
}
steps {
lock (vmResource) {
script {
timeout (time: 20, unit: 'MINUTES') {
try {
@@ -381,10 +406,12 @@ pipeline {
}
}
}
}
}
}
stage ("Test basic simulator") {
steps {
lock (vmResource) {
script {
timeout (time: 30, unit: 'MINUTES') {
try {
@@ -396,10 +423,12 @@ pipeline {
}
}
}
}
}
}
stage ("Test L1 simulator") {
steps {
lock (vmResource) {
script {
timeout (time: 30, unit: 'MINUTES') {
try {
@@ -411,10 +440,12 @@ pipeline {
}
}
}
}
}
}
stage ("Test RF simulator") {
steps {
lock (vmResource) {
script {
timeout (time: 40, unit: 'MINUTES') {
try {
@@ -426,10 +457,12 @@ pipeline {
}
}
}
}
}
}
stage ("Test L2 simulator") {
steps {
lock (vmResource) {
script {
timeout (time: 30, unit: 'MINUTES') {
try {
@@ -441,11 +474,14 @@ pipeline {
}
}
}
}
}
}
stage ("Destroy all Virtual Machines") {
steps {
lock (vmResource) {
sh "./ci-scripts/oai-ci-vm-tool destroy --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
}
File diff suppressed because it is too large Load Diff
@@ -45,8 +45,8 @@ gNBs =
dl_carrierBandwidth = 106;
#initialDownlinkBWP
#genericParameters
# this is RBstart=0,L=50 (275*(L-1))+RBstart
initialDLBWPlocationAndBandwidth = 13475;
# this is RBstart=41,L=24 (275*(L-1))+RBstart
initialDLBWPlocationAndBandwidth = 6366;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialDLBWPsubcarrierSpacing = 1;
@@ -59,7 +59,7 @@ gNBs =
#initialULBWPmappingType
#0=typeA,1=typeB
initialDLBWPmappingType_0 = 0;
#this is SS=2,L=3
#this is SS=1,L=13
initialDLBWPstartSymbolAndLength_0 = 40;
initialDLBWPk0_1 = 0;
@@ -74,7 +74,7 @@ gNBs =
initialDLBWPk0_3 = 0;
initialDLBWPmappingType_3 = 0;
#this is SS=1,L=4
#this is SS=1,L=5
initialDLBWPstartSymbolAndLength_3 = 57;
#uplinkConfigCommon
@@ -89,7 +89,7 @@ gNBs =
pMax = 20;
#initialUplinkBWP
#genericParameters
initialULBWPlocationAndBandwidth = 13475;
initialULBWPlocationAndBandwidth = 6366;
# subcarrierSpacing
# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120
initialULBWPsubcarrierSpacing = 1;
@@ -135,8 +135,8 @@ gNBs =
initialULBWPmappingType_0 = 1
# this is SS=0 L=11
initialULBWPstartSymbolAndLength_0 = 55;
initialULBWPk2_1 = 6;
initialULBWPk2_1 = 6;
initialULBWPmappingType_1 = 1;
# this is SS=0 L=12
initialULBWPstartSymbolAndLength_1 = 69;
@@ -145,7 +145,7 @@ gNBs =
initialULBWPmappingType_2 = 1;
# this is SS=10 L=4
initialULBWPstartSymbolAndLength_2 = 52;
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;
@@ -249,7 +249,7 @@ RUs = (
eNB_instances = [0];
#beamforming 1x4 matrix:
bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000];
sdr_addrs = "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";
}
);
+2 -1
View File
@@ -65,6 +65,7 @@ class EPCManagement():
self.testCase_id = ''
self.MmeIPAddress = ''
self.containerPrefix = 'prod'
self.mmeConfFile = 'mme.conf'
#-----------------------------------------------------------
@@ -127,7 +128,7 @@ class EPCManagement():
logging.debug('Using the OAI EPC Release 14 MME in Docker')
mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-mme /bin/bash -c "nohup tshark -i eth0 -i lo:s10 -w /tmp/mme_check_run.pcap 2>&1 > /dev/null"', '\$', 5)
time.sleep(5)
mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-mme /bin/bash -c "nohup ./bin/oai_mme -c ./etc/mme.conf > mme_check_run.log 2>&1"', '\$', 5)
mySSH.command('docker exec -d ' + self.containerPrefix + '-oai-mme /bin/bash -c "nohup ./bin/oai_mme -c ./etc/' + self.mmeConfFile + ' > mme_check_run.log 2>&1"', '\$', 5)
elif re.match('OAI-Rel14-CUPS', self.Type, re.IGNORECASE):
logging.debug('Using the OAI EPC Release 14 MME')
mySSH.command('cd ' + self.SourceCodePath + '/scripts', '\$', 5)
+16 -2
View File
@@ -64,6 +64,10 @@ class HTMLManagement():
self.htmlTabIcons = []
self.testXMLfiles = []
self.testUnstable = False
self.testMinStableId = '999999'
self.testStabilityPointReached = False
self.htmleNBFailureMsg = ''
self.htmlUEFailureMsg = ''
@@ -230,13 +234,20 @@ class HTMLManagement():
def CreateHtmlTabFooter(self, passStatus):
if ((not self.htmlFooterCreated) and (self.htmlHeaderCreated)):
testOkEvenIfUnstable = False
if self.testUnstable and not passStatus:
if self.testStabilityPointReached or self.testMinStableId == '999999':
testOkEvenIfUnstable = True
self.htmlFile = open('test_results.html', 'a')
self.htmlFile.write(' <tr>\n')
self.htmlFile.write(' <th bgcolor = "#33CCFF" colspan=3>Final Tab Status</th>\n')
if passStatus:
self.htmlFile.write(' <th bgcolor = "green" colspan=' + str(2 + self.htmlUEConnected) + '><font color="white">PASS <span class="glyphicon glyphicon-ok"></span> </font></th>\n')
else:
self.htmlFile.write(' <th bgcolor = "red" colspan=' + str(2 + self.htmlUEConnected) + '><font color="white">FAIL <span class="glyphicon glyphicon-remove"></span> </font></th>\n')
if testOkEvenIfUnstable:
self.htmlFile.write(' <th bgcolor = "orange" colspan=' + str(2 + self.htmlUEConnected) + '><font color="white">KNOWN UNSTABLE SCENARIO <span class="glyphicon glyphicon-exclamation-sign"></span> </font></th>\n')
else:
self.htmlFile.write(' <th bgcolor = "red" colspan=' + str(2 + self.htmlUEConnected) + '><font color="white">FAIL <span class="glyphicon glyphicon-remove"></span> </font></th>\n')
self.htmlFile.write(' </tr>\n')
self.htmlFile.write(' </table>\n')
self.htmlFile.write(' </div>\n')
@@ -246,7 +257,10 @@ class HTMLManagement():
cmd = "sed -i -e 's/__STATE_" + self.htmlTabNames[0] + "__//' test_results.html"
subprocess.run(cmd, shell=True)
else:
cmd = "sed -i -e 's/__STATE_" + self.htmlTabNames[0] + "__/<span class=\"glyphicon glyphicon-remove\"><\/span>/' test_results.html"
if testOkEvenIfUnstable:
cmd = "sed -i -e 's/__STATE_" + self.htmlTabNames[0] + "__/<span class=\"glyphicon glyphicon-exclamation-sign\"><\/span>/' test_results.html"
else:
cmd = "sed -i -e 's/__STATE_" + self.htmlTabNames[0] + "__/<span class=\"glyphicon glyphicon-remove\"><\/span>/' test_results.html"
subprocess.run(cmd, shell=True)
self.htmlFooterCreated = False
+66 -3092
View File
File diff suppressed because it is too large Load Diff
+42 -50
View File
@@ -470,7 +470,7 @@ function report_test {
then
NB_UE_TUNNEL_UP=`egrep -c "Interface oaitun_ue1 successfully configured" $UE_LOG`
else
NB_UE_TUNNEL_UP=`egrep -c "executing ifconfig oaitun_ue1" $UE_LOG`
NB_UE_TUNNEL_UP=`egrep -c "ip link set oaitun_ue1 up" $UE_LOG`
fi
if [ $NB_ENB_GOT_SYNC -gt 0 ] && [ $NB_UE_GOT_SYNC -gt 0 ] && [ $NB_ENB_SYNCED_WITH_UE -gt 0 ]
then
@@ -768,55 +768,47 @@ function report_test {
#RA test (--do-ra option)
# Currently disabled
# #build log files names
# RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_test.log
# RA_UE_LOG=$ARCHIVES_LOC/ra_check_${TMODE}_${BW}prb_${CN_CONFIG}_ue_ra_test.log
# if [ -f $RA_ENB_LOG ] && [ -f $RA_UE_LOG ]
# then
# #get rid of full path
# NAME_ENB=`echo $RA_ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
# NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
# echo " <tr>" >> ./test_simulator_results.html
# echo " <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
# echo " <td>Check if RA proc succeeded</td>" >> ./test_simulator_results.html
#
# #gNB RA check
# GNB_RECEIVED=`egrep -c "received correctly" $RA_ENB_LOG`
# GNB_CONNECTED=`egrep -c "now 5G connected" $RA_ENB_LOG`
# #UE RA check
# UE_RA_PROC_OK=`egrep -c "RA procedure succeeded" $RA_UE_LOG`
#
#
# if [ $GNB_RECEIVED -gt 0 ] && [ $GNB_CONNECTED -gt 0 ] && [ $UE_RA_PROC_OK -gt 0 ]
# then
# echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
# else
# echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
# fi
#
# echo " <td><pre>" >> ./test_simulator_results.html
# if [ $GNB_RECEIVED -gt 0 ]
# then
# echo "<font color = \"blue\">- gNB --> RA received</font>" >> ./test_simulator_results.html
# else
# echo "<font color = \"red\"><b>- gNB RA NOT RECEIVED</b></font>" >> ./test_simulator_results.html
# fi
# if [ $GNB_CONNECTED -gt 0 ]
# then
# echo "<font color = \"blue\">- gNB --> 5G connected</font>" >> ./test_simulator_results.html
# else
# echo "<font color = \"red\"><b>- gNB NOT 5G CONNECTED</b></font>" >> ./test_simulator_results.html
# fi
# if [ $UE_RA_PROC_OK -gt 0 ]
# then
# echo "<font color = \"blue\">- NR UE --> RA procedure succeded</font>" >> ./test_simulator_results.html
# else
# echo "<font color = \"red\"><b>- NR UE RA procedure failed</b></font>" >> ./test_simulator_results.html
# fi
# echo " </pre></td>" >> ./test_simulator_results.html
# echo " </tr>" >> ./test_simulator_results.html
# fi
#build log files names
RA_ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb_ra_test.log
RA_UE_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_ue_ra_test.log
if [ -f $RA_ENB_LOG ] && [ -f $RA_UE_LOG ]
then
#get rid of full path
NAME_ENB=`echo $RA_ENB_LOG | sed -e "s#$ARCHIVES_LOC/##"`
NAME_UE=`echo $RA_UE_LOG | sed -e "s#$ARCHIVES_LOC/##"`
echo " <tr>" >> ./test_simulator_results.html
echo " <td>$NAME_ENB --- $NAME_UE</td>" >> ./test_simulator_results.html
echo " <td>Check if RA proc succeeded</td>" >> ./test_simulator_results.html
#gNB RA check
GNB_RECEIVED=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $RA_ENB_LOG`
#UE RA check
UE_RA_PROC_OK=`egrep -c "\[RAPROC\] RA procedure succeeded" $RA_UE_LOG`
if [ $GNB_RECEIVED -gt 0 ] && [ $UE_RA_PROC_OK -gt 0 ]
then
echo " <td bgcolor = \"green\" >OK</td>" >> ./test_simulator_results.html
else
echo " <td bgcolor = \"red\" >KO</td>" >> ./test_simulator_results.html
fi
echo " <td><pre>" >> ./test_simulator_results.html
if [ $GNB_RECEIVED -gt 0 ]
then
echo "<font color = \"blue\">- gNB --> RA received</font>" >> ./test_simulator_results.html
else
echo "<font color = \"red\"><b>- gNB RA NOT RECEIVED</b></font>" >> ./test_simulator_results.html
fi
if [ $UE_RA_PROC_OK -gt 0 ]
then
echo "<font color = \"blue\">- NR UE --> RA procedure succeded</font>" >> ./test_simulator_results.html
else
echo "<font color = \"red\"><b>- NR UE RA procedure failed</b></font>" >> ./test_simulator_results.html
fi
echo " </pre></td>" >> ./test_simulator_results.html
echo " </tr>" >> ./test_simulator_results.html
fi
#SYNC test
ENB_LOG=$ARCHIVES_LOC/${TMODE}_${BW}prb_${CN_CONFIG}_gnb.log
+68 -52
View File
@@ -281,14 +281,35 @@ function check_ra_result {
local LOC_GNB_LOG=$1
local LOC_UE_LOG=$2
#gNB RA test
echo "Checking gNB Log for RA success"
egrep "received correctly" $1
egrep "now 5G connected" $1
#UE RA test
echo 'Checking UE Log for RA success'
egrep "RA procedure succeeded" $2
#if log files exist
if [ -f $LOC_GNB_LOG ] && [ -f $LOC_UE_LOG ]
then
#gNB RA test
#console check
echo "Checking gNB Log for RA success"
egrep "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $1
#script check
local GNB_COMPLETE=`egrep -c "\[RAPROC\] PUSCH with TC_RNTI (.+) received correctly" $1`
#UE RA test
#console check
echo 'Checking UE Log for RA success'
egrep "\[RAPROC\] RA procedure succeeded" $2
#script check
local UE_COMPLETE=`egrep -c "\[RAPROC\] RA procedure succeeded" $2`
#generate status
if [ $GNB_COMPLETE -eq 0 ] || [ $UE_COMPLETE -eq 0 ]
then
RA_STATUS=-1
echo "RA test FAILED, could not find the markers"
fi
#case where log files do not exist
else
echo "RA test log files not present"
RA_STATUS=-1
fi
}
@@ -1225,16 +1246,6 @@ function start_rf_sim_gnb {
ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR < $1
rm $1
# For the moment, in RA test, no check and no copy of generated raw files
if [ $LOC_RA_TEST -eq 1 ] # RA test
then
sleep 30
echo "echo \"free -m\"" > $1
echo "free -m" >> $1
ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_GNB_VM_IP_ADDR < $1
rm $1
return 0
fi
local i="0"
echo "egrep -c \"got sync\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
@@ -1258,7 +1269,9 @@ function start_rf_sim_gnb {
GNB_SYNC=1
echo "RF-SIM gNB is sync'ed: waiting for UE(s) to connect"
fi
if [ $LOC_S1_CONFIGURATION -eq 0 ]
# check noS1 config only outside RA test (as it does not support noS1)
if [ $LOC_S1_CONFIGURATION -eq 0 ] && [ $LOC_RA_TEST -eq 0 ]
then
echo "ifconfig oaitun_enb1 | egrep -c \"inet addr\"" > $1
# Checking oaitun_enb1 interface has now an IP address
@@ -1341,14 +1354,6 @@ function start_rf_sim_nr_ue {
ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_NR_UE_VM_IP_ADDR < $1
rm $1
# In case of RA test mode, no UE sync check for the moment.
# To be removed later?
if [ $LOC_RA_TEST -eq 1 ] # RA test
then
sleep 30
NR_UE_SYNC=1
return 0
fi
local i="0"
echo "egrep -c \"Initial sync: pbch decoded sucessfully\" /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE" > $1
while [ $i -lt 10 ]
@@ -1372,11 +1377,13 @@ function start_rf_sim_nr_ue {
else
echo "RF-SIM NR-UE is sync'ed w/ gNB"
fi
# Checking oaitun_ue1 interface has now an IP address
i="0"
echo "ifconfig oaitun_ue1 | egrep -c \"inet addr\"" > $1
while [ $i -lt 10 ]
do
# Checking oaitun_ue1 interface has now an IP address (only outside RA test)
if [ $LOC_RA_TEST -eq 0 ]
then
i="0"
echo "ifconfig oaitun_ue1 | egrep -c \"inet addr\"" > $1
while [ $i -lt 10 ]
do
sleep 5
CONNECTED=`ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_NR_UE_VM_IP_ADDR < $1`
if [ $CONNECTED -eq 1 ]
@@ -1385,21 +1392,20 @@ function start_rf_sim_nr_ue {
else
i=$[$i+1]
fi
done
echo "echo \"free -m\"" > $1
echo "free -m" >> $1
ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_NR_UE_VM_IP_ADDR < $1
rm $1
if [ $i -lt 50 ]
then
done
echo "echo \"free -m\"" > $1
echo "free -m" >> $1
ssh -T -o StrictHostKeyChecking=no ubuntu@$LOC_NR_UE_VM_IP_ADDR < $1
rm $1
if [ $i -lt 50 ]
then
NR_UE_SYNC=0
echo "RF-SIM NR-UE oaitun_ue1 is DOWN or NOT CONFIGURED"
else
else
echo "RF-SIM NR-UE oaitun_ue1 is UP and CONFIGURED"
fi
sleep 10
fi
sleep 10
fi
}
@@ -2196,10 +2202,11 @@ function run_test_on_vm {
NR_STATUS=0
######### start of RA TEST loop
while [ $try_cnt -lt 1 ]
while [ $try_cnt -lt 10 ] #10 because it hardly succeed within CI
do
SYNC_STATUS=0
RA_STATUS=0
echo "############################################################"
echo "${CN_CONFIG} : Starting the gNB"
@@ -2241,18 +2248,26 @@ function run_test_on_vm {
echo "############################################################"
# Proper check to be done when RA test is working!
#check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE
try_cnt=$[$try_cnt+1]
########### end RA test
check_ra_result $ARCHIVES_LOC/$CURRENT_GNB_LOG_FILE $ARCHIVES_LOC/$CURRENT_NR_UE_LOG_FILE
if [ $RA_STATUS -ne 0 ]
then
echo "RA test NOT OK"
try_cnt=$[$try_cnt+1]
else
try_cnt=$[$try_cnt+10]
fi
done
sleep 10
try_cnt="0"
########### end RA test
sleep 30
######### start of PHY TEST loop
try_cnt="0"
while [ $try_cnt -lt 4 ]
do
SYNC_STATUS=0
PING_STATUS=0
IPERF_STATUS=0
@@ -2355,6 +2370,7 @@ function run_test_on_vm {
echo "Checking run status"
echo "############################################################"
if [ $RA_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $SYNC_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $PING_STATUS -ne 0 ]; then NR_STATUS=-1; fi
if [ $IPERF_STATUS -ne 0 ]; then NR_STATUS=-1; fi
@@ -25,6 +25,7 @@
<htmlTabName>Test-LTE-M-10MHz-TM1</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>1</repeatCount>
<TestUnstable>True</TestUnstable>
<TestCaseRequestedList>
030201
040102
@@ -26,6 +26,8 @@
<htmlTabName>Test-05MHz-TM2</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>2</repeatCount>
<TestUnstable>True</TestUnstable>
<TestMinId>040608</TestMinId>
<TestCaseRequestedList>
030201
040101
@@ -24,6 +24,8 @@
<htmlTabRef>test-10-tm1</htmlTabRef>
<htmlTabName>Test-10MHz-TM1</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<TestUnstable>True</TestUnstable>
<TestMinId>040615</TestMinId>
<TestCaseRequestedList>
030201
040101
@@ -25,6 +25,8 @@
<htmlTabName>Test-20MHz-TM1</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>4</repeatCount>
<TestUnstable>True</TestUnstable>
<TestMinId>040623</TestMinId>
<TestCaseRequestedList>
030201
040101
@@ -24,6 +24,8 @@
<htmlTabRef>test-20-tm1-defSched</htmlTabRef>
<htmlTabName>Test-20MHz-TM1-default-scheduler</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<TestUnstable>True</TestUnstable>
<TestMinId>040522</TestMinId>
<TestCaseRequestedList>
030201
040101
@@ -0,0 +1,49 @@
<!--
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>epc-start-tab</htmlTabRef>
<htmlTabName>EPC-Start</htmlTabName>
<htmlTabIcon>log-in</htmlTabIcon>
<TestCaseRequestedList>
000100 000101 000102
</TestCaseRequestedList>
<TestCaseExclusionList>
</TestCaseExclusionList>
<testCase id="000100">
<class>Initialize_HSS</class>
<desc>Initialize HSS</desc>
</testCase>
<testCase id="000101">
<class>Initialize_MME</class>
<desc>Initialize MME</desc>
<option>mme-verizon.conf</option>
</testCase>
<testCase id="000102">
<class>Initialize_SPGW</class>
<desc>Initialize SPGW</desc>
</testCase>
</testCaseList>
@@ -0,0 +1,151 @@
<!--
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
030101 040301 040501 040603 040604 040605 040606 040607 040641 040642 040643 040644 040401 040201 030201
-->
<testCaseList>
<htmlTabRef>test-05-tm1</htmlTabRef>
<htmlTabName>Test-05MHz-TM1</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<TestCaseRequestedList>
030201
040101
030101 040301 000001 040501 040603 040401 030201
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="000001">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>5</idle_sleep_time_in_sec>
</testCase>
<testCase id="030101">
<class>Initialize_eNB</class>
<desc>Initialize eNB (FDD/Band7/5MHz)</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/enb.band7.tm1.25PRB.usrpb210.conf --eNBs.[0].plmn_list.[0].mcc 311 --eNBs.[0].plmn_list.[0].mnc 480 --eNBs.[0].plmn_list.[0].mnc_length 3 --eNBs.[0].component_carriers.[0].Nid_cell 10</Initialize_eNB_args>
</testCase>
<testCase id="030201">
<class>Terminate_eNB</class>
<desc>Terminate eNB</desc>
</testCase>
<testCase id="040101">
<class>Initialize_UE</class>
<desc>Initialize UE</desc>
</testCase>
<testCase id="040201">
<class>Terminate_UE</class>
<desc>Terminate UE</desc>
</testCase>
<testCase id="040301">
<class>Attach_UE</class>
<desc>Attach UE</desc>
</testCase>
<testCase id="040401">
<class>Detach_UE</class>
<desc>Detach UE</desc>
</testCase>
<testCase id="040501">
<class>Ping</class>
<desc>ping (5MHz - 20 sec)</desc>
<ping_args>-c 20</ping_args>
<ping_packetloss_threshold>5</ping_packetloss_threshold>
</testCase>
<testCase id="040603">
<class>Iperf</class>
<desc>iperf (5MHz - DL/15Mbps/UDP)(30 sec)(balanced profile)</desc>
<iperf_args>-u -b 15M -t 30 -i 1</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>balanced</iperf_profile>
</testCase>
<testCase id="040604">
<class>Iperf</class>
<desc>iperf (5MHz - DL/15Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 15M -t 30 -i 1</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="040605">
<class>Iperf</class>
<desc>iperf (5MHz - DL/15Mbps/UDP)(30 sec)(unbalanced profile)</desc>
<iperf_args>-u -b 15M -t 30 -i 1</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>unbalanced</iperf_profile>
</testCase>
<testCase id="040606">
<class>Iperf</class>
<desc>iperf (5MHz - DL/TCP)(30 sec)(single-ue profile)</desc>
<iperf_args>-t 30 -i 1 -fm</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="040607">
<class>Iperf</class>
<desc>iperf (5MHz - DL/TCP)(30 sec)(balanced profile)</desc>
<iperf_args>-t 30 -i 1 -fm</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>balanced</iperf_profile>
</testCase>
<testCase id="040641">
<class>Iperf</class>
<desc>iperf (5MHz - UL/9Mbps/UDP)(30 sec)(balanced profile)</desc>
<iperf_args>-u -b 9M -t 30 -i 1 -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>balanced</iperf_profile>
</testCase>
<testCase id="040642">
<class>Iperf</class>
<desc>iperf (5MHz - UL/9Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 9M -t 30 -i 1 -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="040643">
<class>Iperf</class>
<desc>iperf (5MHz - UL/TCP)(30 sec)(single-ue profile)</desc>
<iperf_args>-t 30 -i 1 -fm -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="040644">
<class>Iperf</class>
<desc>iperf (5MHz - UL/TCP)(30 sec)(balanced profile)</desc>
<iperf_args>-t 30 -i 1 -fm -R</iperf_args>
<iperf_packetloss_threshold>50</iperf_packetloss_threshold>
<iperf_profile>balanced</iperf_profile>
</testCase>
</testCaseList>
@@ -25,6 +25,8 @@
<htmlTabName>Test-10MHz</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>2</repeatCount>
<TestUnstable>True</TestUnstable>
<TestMinId>040612</TestMinId>
<TestCaseRequestedList>
030201
040101
@@ -26,6 +26,7 @@
<htmlTabName>Test-X2-HO-FDD-05MHz-TM1</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>2</repeatCount>
<TestUnstable>True</TestUnstable>
<TestCaseRequestedList>
030201 030202
040101
+14 -1
View File
@@ -825,7 +825,6 @@ add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchang
add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE")
add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE")
########################
# Include order
@@ -1095,9 +1094,22 @@ add_library(FLEXRAN_AGENT
${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_slice_verification.c
${OPENAIR2_DIR}/ENB_APP/flexran_agent_app.c
)
add_dependencies(FLEXRAN_AGENT rrc_flag)
set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT)
add_library(flapp_sample SHARED
${OPENAIR2_DIR}/ENB_APP/flexran_apps/sample.c
)
set_target_properties(flapp_sample PROPERTIES C_VISIBILITY_PRESET hidden)
add_library(flapp_imsi SHARED
${OPENAIR2_DIR}/ENB_APP/flexran_apps/imsi.c
)
set_target_properties(flapp_imsi PROPERTIES C_VISIBILITY_PRESET hidden)
add_custom_target(flapp_all DEPENDS
flapp_sample
flapp_imsi
)
#include_directories(${OPENAIR2_DIR}/ENB_APP)
set(PROTOBUF_LIB "protobuf-c")
@@ -1581,6 +1593,7 @@ set(PHY_SRC_UE
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_llr_computation.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_ulsch_demodulation.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_dmrs_rx.c
${OPENAIR1_DIR}/PHY/NR_TRANSPORT/nr_csi_rs.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gold.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/scrambling_luts.c
${OPENAIR1_DIR}/PHY/NR_REFSIG/nr_gen_mod_table.c
-6
View File
@@ -42,7 +42,6 @@ MSC_GEN=0
XFORMS="True"
SKIP_SHARED_LIB_FLAG="False"
UE_EXPANSION="False"
UESIM_EXPANSION="False"
PRINT_STATS="False"
VCD_TIMING="False"
DEADLINE_SCHEDULER_FLAG_USER=""
@@ -264,10 +263,6 @@ function main() {
UE_EXPANSION="True"
echo_info "Will compile with UE_EXPANSION"
shift;;
--musim)
UESIM_EXPANSION="True"
echo_info "Will compile with UESIM_EXPANSION"
shift;;
--UE-conf-nvram)
conf_nvram_path=$(readlink -f $2)
shift 2;;
@@ -593,7 +588,6 @@ function main() {
echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file
# echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file
echo "set ( UESIM_EXPANSION $UESIM_EXPANSION )" >> $cmake_file
echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file
echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file
echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file
@@ -4,7 +4,6 @@ set ( CMAKE_BUILD_TYPE )
set ( CFLAGS_PROCESSOR_USER "" )
set ( UE_EXPANSION False )
set ( PRE_SCD_THREAD False )
set ( UESIM_EXPANSION False )
set ( ENABLE_VCD_FIFO False )
set ( RF_BOARD "None")
set ( TRANSP_PRO "None")
+16
View File
@@ -85,6 +85,10 @@ ID = ENB_PHY_MIB
DESC = MIB data
GROUP = ALL:PHY:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,frame : int,subframe : buffer,data
ID = GNB_PHY_MIB
DESC = NR MIB data
GROUP = ALL:PHY:GNB:WIRESHARK
FORMAT = int,gNB_ID : int,frame : int,slot : buffer,data
#MAC logs
ID = ENB_MAC_UE_DL_SDU
@@ -131,6 +135,18 @@ ID = ENB_MAC_UE_DL_RAR_PDU_WITH_DATA
DESC = MAC downlink PDU for an UE
GROUP = ALL:MAC:ENB:WIRESHARK
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : buffer,data
ID = GNB_MAC_DL_PDU_WITH_DATA
DESC = NR MAC downlink PDU for an UE
GROUP = ALL:MAC:GNB:WIRESHARK
FORMAT = int,gNB_ID : int,CC_id : int,rnti : int,frame : int,slot : int,harq_pid : buffer,data
ID = GNB_MAC_UL_PDU_WITH_DATA
DESC = NR MAC uplink PDU for an UE
GROUP = ALL:MAC:GNB:WIRESHARK
FORMAT = int,gNB_ID : int,CC_id : int,rnti : int,frame : int,slot : int,harq_pid : buffer,data
ID = GNB_MAC_DL_RAR_PDU_WITH_DATA
DESC = NR MAC downlink PDU for RAR
GROUP = ALL:MAC:GNB:WIRESHARK
FORMAT = int,gNB_ID : int,CC_id : int,rnti : int,frame : int,slot : int,harq_pid : buffer,data
#RLC logs
ID = ENB_RLC_DL
+279 -40
View File
@@ -23,6 +23,8 @@ typedef struct {
int socket;
struct sockaddr_in to;
OBUF buf;
/* LTE traces */
/* ul */
int ul_rnti;
int ul_frame;
@@ -46,6 +48,28 @@ typedef struct {
int rar_frame;
int rar_subframe;
int rar_data;
/* NR traces */
/* NR ul */
int nr_ul_rnti;
int nr_ul_frame;
int nr_ul_slot;
int nr_ul_data;
/* NR dl */
int nr_dl_rnti;
int nr_dl_frame;
int nr_dl_slot;
int nr_dl_data;
/* NR mib */
int nr_mib_frame;
int nr_mib_slot;
int nr_mib_data;
/* NR RAR */
int nr_rar_rnti;
int nr_rar_frame;
int nr_rar_slot;
int nr_rar_data;
/* config */
int no_mib;
int no_sib;
@@ -58,8 +82,13 @@ typedef struct {
int cur_sib;
} ev_data;
void trace(ev_data *d, int direction, int rnti_type, int rnti,
int frame, int subframe, void *buf, int bufsize, int preamble) {
/****************************************************************************/
/* LTE */
/****************************************************************************/
void trace_lte(ev_data *d, int direction, int rnti_type, int rnti,
int frame, int subframe, void *buf, int bufsize, int preamble)
{
ssize_t ret;
int fsf;
int i;
@@ -100,15 +129,17 @@ void trace(ev_data *d, int direction, int rnti_type, int rnti,
if (ret != d->buf.osize) abort();
}
void ul(void *_d, event e) {
void ul(void *_d, event e)
{
ev_data *d = _d;
trace(d, DIRECTION_UPLINK, C_RNTI, e.e[d->ul_rnti].i,
e.e[d->ul_frame].i, e.e[d->ul_subframe].i,
e.e[d->ul_data].b, e.e[d->ul_data].bsize,
NO_PREAMBLE);
trace_lte(d, DIRECTION_UPLINK, C_RNTI, e.e[d->ul_rnti].i,
e.e[d->ul_frame].i, e.e[d->ul_subframe].i,
e.e[d->ul_data].b, e.e[d->ul_data].bsize,
NO_PREAMBLE);
}
void dl(void *_d, event e) {
void dl(void *_d, event e)
{
ev_data *d = _d;
if (e.e[d->dl_rnti].i == 0xffff) {
@@ -119,14 +150,15 @@ void dl(void *_d, event e) {
d->cur_sib++;
}
trace(d, DIRECTION_DOWNLINK,
e.e[d->dl_rnti].i != 0xffff ? C_RNTI : SI_RNTI, e.e[d->dl_rnti].i,
e.e[d->dl_frame].i, e.e[d->dl_subframe].i,
e.e[d->dl_data].b, e.e[d->dl_data].bsize,
NO_PREAMBLE);
trace_lte(d, DIRECTION_DOWNLINK,
e.e[d->dl_rnti].i != 0xffff ? C_RNTI : SI_RNTI, e.e[d->dl_rnti].i,
e.e[d->dl_frame].i, e.e[d->dl_subframe].i,
e.e[d->dl_data].b, e.e[d->dl_data].bsize,
NO_PREAMBLE);
}
void mib(void *_d, event e) {
void mib(void *_d, event e)
{
ev_data *d = _d;
if (d->no_mib) return;
@@ -134,30 +166,141 @@ void mib(void *_d, event e) {
if (d->max_mib && d->cur_mib == d->max_mib) return;
d->cur_mib++;
trace(d, DIRECTION_DOWNLINK, NO_RNTI, 0,
e.e[d->mib_frame].i, e.e[d->mib_subframe].i,
e.e[d->mib_data].b, e.e[d->mib_data].bsize,
NO_PREAMBLE);
trace_lte(d, DIRECTION_DOWNLINK, NO_RNTI, 0,
e.e[d->mib_frame].i, e.e[d->mib_subframe].i,
e.e[d->mib_data].b, e.e[d->mib_data].bsize,
NO_PREAMBLE);
}
void preamble(void *_d, event e) {
void preamble(void *_d, event e)
{
ev_data *d = _d;
trace(d, DIRECTION_UPLINK, NO_RNTI, 0,
e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i,
NULL, 0,
e.e[d->preamble_preamble].i);
trace_lte(d, DIRECTION_UPLINK, NO_RNTI, 0,
e.e[d->preamble_frame].i, e.e[d->preamble_subframe].i,
NULL, 0,
e.e[d->preamble_preamble].i);
}
void rar(void *_d, event e) {
void rar(void *_d, event e)
{
ev_data *d = _d;
trace(d, DIRECTION_DOWNLINK, RA_RNTI, e.e[d->rar_rnti].i,
e.e[d->rar_frame].i, e.e[d->rar_subframe].i,
e.e[d->rar_data].b, e.e[d->rar_data].bsize,
NO_PREAMBLE);
trace_lte(d, DIRECTION_DOWNLINK, RA_RNTI, e.e[d->rar_rnti].i,
e.e[d->rar_frame].i, e.e[d->rar_subframe].i,
e.e[d->rar_data].b, e.e[d->rar_data].bsize,
NO_PREAMBLE);
}
/****************************************************************************/
/* NR */
/****************************************************************************/
#define MAC_NR_START_STRING "mac-nr"
#define MAC_NR_PAYLOAD_TAG 0x01
#define MAC_NR_RNTI_TAG 0x02
#define MAC_NR_FRAME_SLOT_TAG 0x07
#define NR_FDD_RADIO 1
#define NR_TDD_RADIO 2
#define NR_DIRECTION_UPLINK 0
#define NR_DIRECTION_DOWNLINK 1
#define NR_NO_RNTI 0
#define NR_RA_RNTI 2
#define NR_C_RNTI 3
void trace_nr(ev_data *d, int direction, int rnti_type, int rnti,
int frame, int slot, void *buf, int bufsize, int preamble)
{
ssize_t ret;
int i;
d->buf.osize = 0;
PUTS(&d->buf, MAC_NR_START_STRING);
PUTC(&d->buf, NR_TDD_RADIO);
PUTC(&d->buf, direction);
PUTC(&d->buf, rnti_type);
if (rnti_type == NR_C_RNTI || rnti_type == NR_RA_RNTI) {
PUTC(&d->buf, MAC_NR_RNTI_TAG);
PUTC(&d->buf, (rnti>>8) & 255);
PUTC(&d->buf, rnti & 255);
}
#if 0
/* for old versions of wireshark; not sure if correct */
int fsf = (frame << 4) + slot;
PUTC(&d->buf, 4 /* MAC_NR_FRAME_SUBFRAME_TAG */);
PUTC(&d->buf, (fsf>>8) & 255);
PUTC(&d->buf, fsf & 255);
#else
PUTC(&d->buf, MAC_NR_FRAME_SLOT_TAG);
PUTC(&d->buf, (frame>>8) & 255);
PUTC(&d->buf, frame & 255);
PUTC(&d->buf, (slot>>8) & 255);
PUTC(&d->buf, slot & 255);
#endif
PUTC(&d->buf, MAC_NR_PAYLOAD_TAG);
for (i = 0; i < bufsize; i++)
PUTC(&d->buf, ((char *)buf)[i]);
ret = sendto(d->socket, d->buf.obuf, d->buf.osize, 0,
(struct sockaddr *)&d->to, sizeof(struct sockaddr_in));
if (ret != d->buf.osize) abort();
}
void nr_ul(void *_d, event e)
{
ev_data *d = _d;
trace_nr(d, NR_DIRECTION_UPLINK, NR_C_RNTI, e.e[d->nr_ul_rnti].i,
e.e[d->nr_ul_frame].i, e.e[d->nr_ul_slot].i,
e.e[d->nr_ul_data].b, e.e[d->nr_ul_data].bsize, NO_PREAMBLE);
}
void nr_dl(void *_d, event e)
{
ev_data *d = _d;
trace_nr(d, NR_DIRECTION_DOWNLINK, NR_C_RNTI, e.e[d->nr_dl_rnti].i,
e.e[d->nr_dl_frame].i, e.e[d->nr_dl_slot].i,
e.e[d->nr_dl_data].b, e.e[d->nr_dl_data].bsize, NO_PREAMBLE);
}
void nr_mib(void *_d, event e)
{
ev_data *d = _d;
if (d->no_mib) return;
if (d->max_mib && d->cur_mib == d->max_mib) return;
d->cur_mib++;
trace_nr(d, NR_DIRECTION_DOWNLINK, NR_NO_RNTI, 0,
e.e[d->nr_mib_frame].i, e.e[d->nr_mib_slot].i,
e.e[d->nr_mib_data].b, e.e[d->nr_mib_data].bsize, NO_PREAMBLE);
}
void nr_rar(void *_d, event e)
{
ev_data *d = _d;
trace_nr(d, NR_DIRECTION_DOWNLINK, NR_RA_RNTI, e.e[d->nr_rar_rnti].i,
e.e[d->nr_rar_frame].i, e.e[d->nr_rar_slot].i,
e.e[d->nr_rar_data].b, e.e[d->nr_rar_data].bsize, NO_PREAMBLE);
}
/****************************************************************************/
/****************************************************************************/
void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id,
int preamble_id, int rar_id) {
int preamble_id, int rar_id,
int nr_ul_id, int nr_dl_id, int nr_mib_id, int nr_rar_id)
{
database_event_format f;
int i;
d->ul_rnti = -1;
@@ -174,10 +317,27 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id,
d->preamble_frame = -1;
d->preamble_subframe = -1;
d->preamble_preamble = -1;
d->rar_rnti = -1;
d->rar_frame = -1;
d->rar_subframe = -1;
d->rar_data = -1;
d->rar_rnti = -1;
d->rar_frame = -1;
d->rar_subframe = -1;
d->rar_data = -1;
d->nr_ul_rnti = -1;
d->nr_ul_frame = -1;
d->nr_ul_slot = -1;
d->nr_ul_data = -1;
d->nr_dl_rnti = -1;
d->nr_dl_frame = -1;
d->nr_dl_slot = -1;
d->nr_dl_data = -1;
d->nr_mib_frame = -1;
d->nr_mib_slot = -1;
d->nr_mib_data = -1;
d->nr_rar_rnti = -1;
d->nr_rar_frame = -1;
d->nr_rar_slot = -1;
d->nr_rar_data = -1;
#define G(var_name, var_type, var) \
if (!strcmp(f.name[i], var_name)) { \
if (strcmp(f.type[i], var_type)) goto error; \
@@ -247,6 +407,60 @@ void setup_data(ev_data *d, void *database, int ul_id, int dl_id, int mib_id,
if (d->rar_rnti == -1 || d->rar_frame == -1 || d->rar_subframe == -1 ||
d->rar_data == -1) goto error;
/* NR ul: rnti, frame, slot, data */
f = get_format(database, nr_ul_id);
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->nr_ul_rnti);
G("frame", "int", d->nr_ul_frame);
G("slot", "int", d->nr_ul_slot);
G("data", "buffer", d->nr_ul_data);
}
if (d->nr_ul_rnti == -1 || d->nr_ul_frame == -1 || d->nr_ul_slot == -1 ||
d->nr_ul_data == -1)
goto error;
/* NR dl: rnti, frame, slot, data */
f = get_format(database, nr_dl_id);
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->nr_dl_rnti);
G("frame", "int", d->nr_dl_frame);
G("slot", "int", d->nr_dl_slot);
G("data", "buffer", d->nr_dl_data);
}
if (d->nr_dl_rnti == -1 || d->nr_dl_frame == -1 || d->nr_dl_slot == -1 ||
d->nr_dl_data == -1)
goto error;
/* NR MIB: frame, slot, data */
f = get_format(database, nr_mib_id);
for (i = 0; i < f.count; i++) {
G("frame", "int", d->nr_mib_frame);
G("slot", "int", d->nr_mib_slot);
G("data", "buffer", d->nr_mib_data);
}
if (d->nr_mib_frame == -1 || d->nr_mib_slot== -1 || d->nr_mib_data == -1)
goto error;
/* NR RAR: rnti, frame, slot, data */
f = get_format(database, nr_rar_id);
for (i = 0; i < f.count; i++) {
G("rnti", "int", d->nr_rar_rnti);
G("frame", "int", d->nr_rar_frame);
G("slot", "int", d->nr_rar_slot);
G("data", "buffer", d->nr_rar_data);
}
if (d->nr_rar_rnti == -1 || d->nr_rar_frame == -1 || d->nr_rar_slot == -1 ||
d->nr_rar_data == -1)
goto error;
#undef G
return;
error:
@@ -254,7 +468,8 @@ error:
abort();
}
void *receiver(void *_d) {
void *receiver(void *_d)
{
ev_data *d = _d;
int s;
char buf[100000];
@@ -279,7 +494,8 @@ void *receiver(void *_d) {
return 0;
}
void usage(void) {
void usage(void)
{
printf(
"options:\n"
" -d <database file> this option is mandatory\n"
@@ -304,14 +520,16 @@ void usage(void) {
exit(1);
}
int main(int n, char **v) {
int main(int n, char **v)
{
char *database_filename = NULL;
char *input_filename = NULL;
void *database;
event_handler *h;
int in;
int i;
int ul_id, dl_id, mib_id = -1, preamble_id, rar_id;
int ul_id, dl_id, mib_id, preamble_id, rar_id;
int nr_ul_id, nr_dl_id, nr_mib_id, nr_rar_id;
ev_data d;
char *ip = DEFAULT_IP;
int port = DEFAULT_PORT;
@@ -382,6 +600,11 @@ int main(int n, char **v) {
on_off(database, "ENB_PHY_INITIATE_RA_PROCEDURE", is_on, 1);
on_off(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA", is_on, 1);
on_off(database, "GNB_MAC_UL_PDU_WITH_DATA", is_on, 1);
on_off(database, "GNB_MAC_DL_PDU_WITH_DATA", is_on, 1);
on_off(database, "GNB_PHY_MIB", is_on, 1);
on_off(database, "GNB_MAC_DL_RAR_PDU_WITH_DATA", is_on, 1);
/* activate selected traces */
if (socket_send(in, &mt, 1) == -1 ||
socket_send(in, &number_of_events, sizeof(int)) == -1 ||
@@ -398,12 +621,26 @@ int main(int n, char **v) {
mib_id = event_id_from_name(database, "ENB_PHY_MIB");
preamble_id = event_id_from_name(database, "ENB_PHY_INITIATE_RA_PROCEDURE");
rar_id = event_id_from_name(database, "ENB_MAC_UE_DL_RAR_PDU_WITH_DATA");
setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id);
nr_ul_id = event_id_from_name(database, "GNB_MAC_UL_PDU_WITH_DATA");
nr_dl_id = event_id_from_name(database, "GNB_MAC_DL_PDU_WITH_DATA");
nr_mib_id = event_id_from_name(database, "GNB_PHY_MIB");
nr_rar_id = event_id_from_name(database, "GNB_MAC_DL_RAR_PDU_WITH_DATA");
setup_data(&d, database, ul_id, dl_id, mib_id, preamble_id, rar_id,
nr_ul_id, nr_dl_id, nr_mib_id, nr_rar_id);
register_handler_function(h, ul_id, ul, &d);
register_handler_function(h, dl_id, dl, &d);
register_handler_function(h, mib_id, mib, &d);
register_handler_function(h, preamble_id, preamble, &d);
register_handler_function(h, rar_id, rar, &d);
register_handler_function(h, nr_ul_id, nr_ul, &d);
register_handler_function(h, nr_dl_id, nr_dl, &d);
register_handler_function(h, nr_mib_id, nr_mib, &d);
register_handler_function(h, nr_rar_id, nr_rar, &d);
d.socket = socket(AF_INET, SOCK_DGRAM, 0);
if (d.socket == -1) {
@@ -424,8 +661,10 @@ int main(int n, char **v) {
if (e.type == -1) break;
if (!(e.type == ul_id || e.type == dl_id || e.type == mib_id ||
e.type == preamble_id || e.type == rar_id)) continue;
if (!(e.type == ul_id || e.type == dl_id || e.type == mib_id ||
e.type == preamble_id || e.type == rar_id ||
e.type == nr_ul_id || e.type == nr_dl_id ||
e.type == nr_mib_id || e.type == nr_rar_id)) continue;
handle_event(h, e);
}
+2 -2
View File
@@ -101,11 +101,11 @@ static inline uint64_t BIT_STRING_to_uint64(BIT_STRING_t *asn) {
shift = ((asn->size - 1) * 8) - asn->bits_unused;
for (index = 0; index < (asn->size - 1); index++) {
result |= asn->buf[index] << shift;
result |= ((uint64_t)asn->buf[index]) << shift;
shift -= 8;
}
result |= asn->buf[index] >> asn->bits_unused;
result |= ((uint64_t)asn->buf[index]) >> asn->bits_unused;
return result;
}
@@ -121,9 +121,11 @@ char toksep[2];
case SCHED_RR:
lptr+=sprintf(lptr,"%s ","rt: rr");
break;
#ifdef SCHED_DEADLINE
case SCHED_DEADLINE:
lptr+=sprintf(lptr,"%s ","rt: deadline");
break;
#endif
default:
lptr+=sprintf(lptr,"%s ","????");
break;
+1 -1
View File
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
FROM image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-ran:ci-ran-tmp AS enb-build
FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:latest AS enb-build
WORKDIR /oai-enb
+2
View File
@@ -49,6 +49,7 @@ RUN yum update -y && \
nettle \
atlas \
net-tools \
iputils \
iproute \
libyaml && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
@@ -120,3 +121,4 @@ WORKDIR /opt/oai-enb
#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"]
#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+3 -2
View File
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
FROM image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-ran:tmp-rhel8-latest AS enb-build
FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS enb-build
WORKDIR /oai-ran
@@ -51,6 +51,7 @@ RUN yum update -y && \
atlas \
net-tools \
iproute \
iputils \
libyaml && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
@@ -121,4 +122,4 @@ WORKDIR /opt/oai-enb
#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"]
#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+2
View File
@@ -57,6 +57,7 @@ RUN apt-get update && \
libconfig9 \
openssl \
net-tools \
iputils-ping \
iproute2 \
libyaml-0-2 && \
# Install UHD driver from ettus ppa
@@ -120,3 +121,4 @@ WORKDIR /opt/oai-enb
#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"]
#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
-92
View File
@@ -1,92 +0,0 @@
#/*
# * 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
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface eNB service
# Valid for RHEL7 in the OpenShift context (v4.4)
#
#---------------------------------------------------------------------
ARG REGISTRY=localhost
FROM $REGISTRY/oai-build-base:latest.el7 AS builder
ARG GIT_TAG=v1.1.1
WORKDIR /root
RUN if [ "$EURECOM_PROXY" == true ]; then git config --global http.proxy http://:@proxy.eurecom.fr:8080; fi
RUN git clone --depth=1 --branch=$GIT_TAG https://gitlab.eurecom.fr/oai/openairinterface5g.git
COPY patches patches/
RUN patch -p1 -d openairinterface5g < patches/disable_building_nasmesh_and_rbtool.patch \
&& patch -p1 -d openairinterface5g < patches/disable_sched_fifo_fail_exits.patch
RUN cd openairinterface5g/cmake_targets \
&& ln -sf /usr/local/bin/asn1c_oai /usr/local/bin/asn1c \
&& ln -sf /usr/local/share/asn1c_oai /usr/local/share/asn1c \
&& ./build_oai -c --eNB -w USRP --verbose-compile
FROM registry.redhat.io/ubi7/ubi
LABEL name="oai-enb" \
version="$GIT_TAG" \
maintainer="Frank A. Zdarsky <fzdarsky@redhat.com>" \
io.k8s.description="openairinterface5g eNB $GIT_TAG." \
io.openshift.tags="oai,enb" \
io.openshift.non-scalable="true"
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
&& REPOLIST="rhel-7-server-optional-rpms" \
&& PKGLIST="boost libconfig lksctp-tools protobuf-c iproute iputils procps-ng bind-utils xforms nettle libyaml libusb" \
# && yum -y upgrade-minimal --setopt=tsflags=nodocs --security --sec-severity=Critical --sec-severity=Important && \
&& yum -y install --enablerepo ${REPOLIST} --setopt=tsflag=nodocs ${PKGLIST} \
&& yum -y clean all \
&& rm -rf /var/cache/yum
ENV APP_ROOT=/opt/oai-enb
ENV PATH=${APP_ROOT}:${PATH} HOME=${APP_ROOT}
COPY --from=builder /root/openairinterface5g/cmake_targets/lte_build_oai/build/lte-softmodem ${APP_ROOT}/bin/
COPY --from=builder /root/openairinterface5g/cmake_targets/lte_build_oai/build/*.so* /lib64
COPY --from=builder /usr/local/lib64 /lib64
COPY --from=builder /usr/local/bin/uhd_* /usr/local/bin
COPY --from=builder /usr/local/share/uhd /usr/local/share/uhd
RUN cd /lib64 \
&& ln -sf liboai_eth_transpro.so liboai_transpro.so \
&& ln -sf liboai_usrpdevif.so liboai_device.so \
&& ln -sf libuhd.so.3.13 libuhd.so.3 \
&& ln -sf libuhd.so.3 libuhd.so
COPY scripts ${APP_ROOT}/bin/
COPY configs ${APP_ROOT}/etc/
RUN chmod -R u+x ${APP_ROOT} && \
chgrp -R 0 ${APP_ROOT} && \
chmod -R g=u ${APP_ROOT} /etc/passwd
USER 10001
WORKDIR ${APP_ROOT}
EXPOSE 2152/udp # S1U, GTP/UDP
EXPOSE 22100/tcp # ?
EXPOSE 36412/udp # S1C, SCTP/UDP
EXPOSE 36422/udp # X2C, SCTP/UDP
EXPOSE 50000/udp # IF5 / ORI (control)
EXPOSE 50001/udp # IF5 / ECPRI (data)
CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"]
ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
+1 -1
View File
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
FROM image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-ran:ci-ran-tmp AS gnb-build
FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:latest AS gnb-build
WORKDIR /oai-gnb
+3 -1
View File
@@ -52,6 +52,8 @@ RUN yum repolist --disablerepo=* && \
atlas \
lksctp-tools \
nettle \
net-tools \
iputils \
libyaml && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
@@ -123,4 +125,4 @@ WORKDIR /opt/oai-gnb
#CMD ["/opt/oai-gnb/bin/nr-softmodem", "-O", "/opt/oai-gnb/etc/gnb.conf"]
#ENTRYPOINT ["/opt/oai-gnb/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+4 -2
View File
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
FROM image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-ran:tmp-rhel8-latest AS gnb-build
FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS gnb-build
WORKDIR /oai-ran
@@ -53,6 +53,8 @@ RUN yum repolist --disablerepo=* && \
atlas \
lksctp-tools \
nettle \
net-tools \
iputils \
libyaml && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
@@ -124,4 +126,4 @@ WORKDIR /opt/oai-gnb
#CMD ["/opt/oai-gnb/bin/nr-softmodem", "-O", "/opt/oai-gnb/etc/gnb.conf"]
#ENTRYPOINT ["/opt/oai-gnb/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+2 -1
View File
@@ -59,6 +59,7 @@ RUN apt-get update && \
openssl \
net-tools \
iproute2 \
iputils-ping \
libyaml-0-2 && \
# Install UHD driver from ettus ppa
# At time of writing, it is 3.14
@@ -121,4 +122,4 @@ WORKDIR /opt/oai-gnb
#CMD ["/opt/oai-gnb/bin/nr-softmodem", "-O", "/opt/oai-gnb/etc/gnb.conf"]
#ENTRYPOINT ["/opt/oai-gnb/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+3 -1
View File
@@ -51,6 +51,7 @@ RUN yum update -y && \
atlas \
iproute \
net-tools \
iputils \
libyaml && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
@@ -114,8 +115,9 @@ RUN ldconfig
# Copy the relevant configuration files for eNB
WORKDIR /opt/oai-lte-ue/etc
COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* .
COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf
WORKDIR /opt/oai-lte-ue
#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"]
#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+4 -2
View File
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
FROM image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-ran:tmp-rhel8-latest AS lte-ue-build
FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS lte-ue-build
WORKDIR /oai-ran
@@ -51,6 +51,7 @@ RUN yum update -y && \
atlas \
iproute \
net-tools \
iputils \
libyaml && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
@@ -114,8 +115,9 @@ RUN ldd /usr/local/lib/libdfts.so
# Copy the relevant configuration files for eNB
WORKDIR /opt/oai-lte-ue/etc
COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* .
COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf
WORKDIR /opt/oai-lte-ue
#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"]
#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+3 -1
View File
@@ -58,6 +58,7 @@ RUN apt-get update && \
libconfig9 \
openssl \
net-tools \
iputils-ping \
iproute2 \
libyaml-0-2 && \
# Install UHD driver from ettus ppa
@@ -114,8 +115,9 @@ RUN ldconfig
# Copy the relevant configuration files for eNB
WORKDIR /opt/oai-lte-ue/etc
COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* ./
COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf
WORKDIR /opt/oai-lte-ue
#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"]
#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+3 -1
View File
@@ -48,6 +48,8 @@ RUN yum update -y && \
yum install -y --enablerepo="ubi-8-codeready-builder" \
lksctp-tools \
nettle \
net-tools \
iputils \
atlas \
libXpm \
libX11 \
@@ -114,4 +116,4 @@ COPY --from=nr-ue-build /oai-ran/ci-scripts/conf_files/ue.* .
WORKDIR /opt/oai-nr-ue
#CMD ["/opt/oai-nr-ue/bin/nr-uesoftmodem", "-O", "/opt/oai-nr-ue/etc/enb.conf"]
#ENTRYPOINT ["/opt/oai-nr-ue/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+4 -2
View File
@@ -25,7 +25,7 @@
#
#---------------------------------------------------------------------
FROM image-registry.openshift-image-registry.svc:5000/oaicicd-ran-tmp/oai-ran:tmp-rhel8-latest AS nr-ue-build
FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS nr-ue-build
WORKDIR /oai-ran
@@ -49,6 +49,8 @@ RUN yum update -y && \
yum install -y --enablerepo="ubi-8-codeready-builder" \
lksctp-tools \
nettle \
net-tools \
iputils \
atlas \
libXpm \
libX11 \
@@ -115,4 +117,4 @@ COPY --from=nr-ue-build /oai-ran/ci-scripts/conf_files/ue.* .
WORKDIR /opt/oai-nr-ue
#CMD ["/opt/oai-nr-ue/bin/nr-uesoftmodem", "-O", "/opt/oai-nr-ue/etc/enb.conf"]
#ENTRYPOINT ["/opt/oai-nr-ue/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+2 -1
View File
@@ -58,6 +58,7 @@ RUN apt-get update && \
libconfig9 \
openssl \
net-tools \
iputils-ping \
iproute2 \
libyaml-0-2 && \
# Install UHD driver from ettus ppa
@@ -114,4 +115,4 @@ COPY --from=nr-ue-build /oai-ran/ci-scripts/conf_files/ue.* .
WORKDIR /opt/oai-nr-ue
#CMD ["/opt/oai-nr-ue/bin/nr-uesoftmodem", "-O", "/opt/oai-nr-ue/etc/enb.conf"]
#ENTRYPOINT ["/opt/oai-nr-ue/bin/entrypoint.sh"]
CMD ["sleep", "infinity"]
+151 -3
View File
@@ -1,5 +1,153 @@
---
to be done
<table style="border-collapse: collapse; border: none;">
<tr style="border-collapse: collapse; border: none;">
<td style="border-collapse: collapse; border: none;">
<a href="http://www.openairinterface.org/">
<img src="../doc/images/oai_final_logo.png" alt="" border=3 height=50 width=150>
</img>
</a>
</td>
<td style="border-collapse: collapse; border: none; vertical-align: center;">
<b><font size = "5">OAI Docker/Podman Build and Usage Procedures</font></b>
</td>
</tr>
</table>
---
**Table of Contents**
1. [Build Strategy](#1-build-strategy)
2. [File organization](#2-file-organization)
3. [Building using docker under Ubuntu 18.04](#3-building-using-docker-under-ubuntu-1804)
4. [Building using podman under Red Hat Entreprise Linux 8.2](#4-building-using-podman-under-red-hat-entreprise-linux-82)
5. [Running modems using docker under Ubuntu 18.04](#5-running-modems-using-docker-under-ubuntu-1804)
6. [Running modems using podman under Red Hat Entreprise Linux 8.2](#6-running-modems-using-podman-under-red-hat-entreprise-linux-82)
---
# 1. Build Strategy #
For all platforms, the strategy for building docker/podman images is the same:
* First we create a common shared image that contains:
- the latest source files (by using the `COPY` function)
- all the means to build an OAI RAN executable
* all packages, compilers, ...
* especially UHD is installed
* Then from this shared image (`ran-build`) we can build target images for:
- eNB
- gNB
- lte-UE
- nr-UE
* These target images will only contain:
- the generated executable (for example `lte-softmodem.Rel15`)
- the generated shared libraries (for example `liboai_usrpdevif.so.Rel15`)
- the needed libraries and packages to run these generated binaries
- Some configuration file templates
- Some tools (such as `ping`, `ifconfig`)
TO DO:
- Proper entrypoints
- Proper port exposure
- ...
# 2. File organization #
Dockerfiles are named with the following naming convention: `Dockerfile.${target}.${OS-version}.${cluster-version}`
Targets can be:
- `ran` for an image named `ran-build` (the shared image)
- `eNB` for an image named `oai-enb`
- `gNB` for an image named `oai-gnb`
- `lteUE` for an image named `oai-lte-ue`
- `nrUE` for an image named `oai-nr-ue`
The currently-supported OS are:
- `rhel8.2` for Red Hat Entreprise Linux
- `ubuntu18` for Ubuntu 18.04 LTS
The currently-supported cluster version is:
- `rhel8.2.oc4-4`
We have also `rhel7.oc4-4` support but it will be discontinued soon.
For more details in build within a Openshift Cluster, see [OpenShift README](../openshift/README.md) for more details.
# 3. Building using `docker` under Ubuntu 18.04 #
## 3.1. Pre-requisites ##
* `git` installed
* `docker-ce` installed
* Pulling `ubuntu:bionic` from DockerHub
## 3.2. Building the shared image ##
This can be done starting `2020.w41` tag on the `develop` branch, or any branch that includes that tag.
```bash
git clone https://gitlab.eurecom.fr/oai/openairinterface5g.git
cd openairinterface5g
git checkout develop
```
In our Eurecom/OSA environment we need to pass a GIT proxy.
```bash
docker build --target ran-build --tag ran-build:latest --file docker/Dockerfile.ran.ubuntu18 --build-arg NEEDED_GIT_PROXY="http://proxy.eurecom.fr:8080" .
```
if you don't need it, do NOT pass any value:
```bash
docker build --target ran-build --tag ran-build:latest --file docker/Dockerfile.ran.ubuntu18 .
```
After a while:
```bash
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
ran-build latest ccb721bc0b57 1 minute ago 4.06GB
...
```
## 3.3. Building any target image ##
For example, the eNB:
```bash
docker build --target oai-enb --tag oai-enb:latest --file docker/Dockerfile.eNB.ubuntu18 .
```
After a while:
```
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
oai-enb latest 25ddbd8b7187 1 minute ago 516MB
<none> <none> 875ea3b05b60 8 minutes ago 8.18GB
ran-build latest ccb721bc0b57 1 hour ago 4.06GB
```
Do not forget to remove the temporary image:
```
docker image prune --force
```
# 4. Building using `podman` under Red Hat Entreprise Linux 8.2 #
TODO.
# 5. Running modems using `docker` under Ubuntu 18.04 #
TODO.
# 6. Running modems using `podman` under Red Hat Entreprise Linux 8.2 #
TODO.
+1 -1
View File
@@ -179,7 +179,7 @@ void prach_eNB_tosplit(uint8_t *bufferZone, int bufSize, PHY_VARS_eNB *eNB, L1_r
ru=eNB->RU_list[i];
for (ru_aa=0,aa=0; ru_aa<ru->nb_rx; ru_aa++,aa++) {
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[ru_aa];
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[0][ru_aa];
int ce_level;
for (ce_level=0; ce_level<4; ce_level++)
+2 -2
View File
@@ -228,7 +228,7 @@ void init_eNB_afterRU(void) {
for (int i=0; i<eNB->RU_list[ru_id]->nb_rx; aa++,i++) {
LOG_I(PHY,"Attaching RU %d antenna %d to eNB antenna %d\n",eNB->RU_list[ru_id]->idx,i,aa);
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[ru_id]->prach_rxsigF[i];
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[ru_id]->prach_rxsigF[0][i];
for (int ce_level=0; ce_level<4; ce_level++)
eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[ru_id]->prach_rxsigF_br[ce_level][i];
@@ -483,7 +483,7 @@ void prach_procedures_ocp(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, int br_flag)
ru=eNB->RU_list[i];
for (ru_aa=0,aa=0; ru_aa<ru->nb_rx; ru_aa++,aa++) {
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[ru_aa];
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[0][ru_aa];
int ce_level;
if (br_flag==1)
+2 -6
View File
@@ -255,11 +255,7 @@ static inline int rxtx(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int frame_t
// TODO: check if this is correct for PARALLEL_RU_L1_TRX_SPLIT
// Do PRACH RU processing
int prach_id=find_nr_prach(gNB,frame_rx,slot_rx,0,SEARCH_EXIST);
if (prach_id>=0) {
L1_nr_prach_procedures(gNB,frame_rx,slot_rx,&gNB->prach_vars.list[prach_id].pdu);
gNB->prach_vars.list[prach_id].frame=-1;
}
L1_nr_prach_procedures(gNB,frame_rx,slot_rx);
phy_procedures_gNB_uespec_RX(gNB, frame_rx, slot_rx);
}
@@ -981,7 +977,7 @@ void init_eNB_afterRU(void) {
for (i=0; i<gNB->RU_list[ru_id]->nb_rx; aa++,i++) {
LOG_I(PHY,"Attaching RU %d antenna %d to gNB antenna %d\n",gNB->RU_list[ru_id]->idx,i,aa);
gNB->prach_vars.rxsigF[aa] = gNB->RU_list[ru_id]->prach_rxsigF[i];
gNB->prach_vars.rxsigF[aa] = gNB->RU_list[ru_id]->prach_rxsigF[0][i];
gNB->common_vars.rxdataF[aa] = gNB->RU_list[ru_id]->common.rxdataF[i];
}
}
+28 -5
View File
@@ -1595,13 +1595,36 @@ void *ru_thread( void *param ) {
(void*)ru->common.rxdataF[aa], fp->symbols_per_slot*fp->ofdm_symbol_size*sizeof(int32_t));
// Do PRACH RU processing
int prach_id=find_nr_prach_ru(ru,proc->frame_rx,proc->tti_rx,SEARCH_EXIST);
uint8_t prachStartSymbol,N_dur;
if (prach_id>=0) {
rx_nr_prach_ru(ru,
ru->prach_list[prach_id].fmt,
ru->prach_list[prach_id].numRA,
ru->prach_list[prach_id].prachStartSymbol,
proc->frame_rx,proc->tti_rx);
N_dur = get_nr_prach_duration(ru->prach_list[prach_id].fmt);
/*
get_nr_prach_info_from_index(ru->config.prach_config.prach_ConfigurationIndex.value,
proc->frame_rx,proc->tti_rx,
ru->config.carrier_config.dl_frequency.value,
fp->numerology_index,
fp->frame_type,
&format,
&start_symbol,
&N_t_slot,
&N_dur,
&RA_sfn_index,
&N_RA_slot,
&config_period);
*/
for (int prach_oc = 0; prach_oc<ru->prach_list[prach_id].num_prach_ocas; prach_oc++) {
prachStartSymbol = ru->prach_list[prach_id].prachStartSymbol+prach_oc*N_dur;
//comment FK: the standard 38.211 section 5.3.2 has one extra term +14*N_RA_slot. This is because there prachStartSymbol is given wrt to start of the 15kHz slot or 60kHz slot. Here we work slot based, so this function is anyway only called in slots where there is PRACH. Its up to the MAC to schedule another PRACH PDU in the case there are there N_RA_slot \in {0,1}.
rx_nr_prach_ru(ru,
ru->prach_list[prach_id].fmt, //could also use format
ru->prach_list[prach_id].numRA,
prachStartSymbol,
prach_oc,
proc->frame_rx,proc->tti_rx);
}
free_nr_ru_prach_entry(ru,prach_id);
}
}
+15 -1
View File
@@ -348,7 +348,15 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
old_sf = sf;
old_sfn = sfn;
if (old_sf == 0 && old_sfn % 100==0) LOG_W( PHY,"[eNB] sfn/sf:%d%d old_sfn/sf:%d%d proc[rx:%d%d]\n", sfn, sf, old_sfn, old_sf, proc->frame_rx, proc->subframe_rx);
if (old_sf == 0 && old_sfn % 100==0)
LOG_D(PHY,
"[eNB] sfn/sf:%d%d old_sfn/sf:%d%d proc[rx:%d%d]\n",
sfn,
sf,
old_sfn,
old_sf,
proc->frame_rx,
proc->subframe_rx);
}
++L1_proc->instance_cnt;
@@ -435,6 +443,7 @@ int phy_rach_indication(struct nfapi_vnf_p7_config *config, nfapi_rach_indicatio
}
if(index == -1){
LOG_E(MAC,"phy_rach_indication : num of rach reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
UL_RCC_INFO.rach_ind[index] = *ind;
@@ -499,6 +508,7 @@ int phy_harq_indication(struct nfapi_vnf_p7_config *config, nfapi_harq_indicatio
}
if(index == -1){
LOG_E(MAC,"phy_harq_indication : num of harq reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
UL_RCC_INFO.harq_ind[index] = *ind;
@@ -538,6 +548,7 @@ int phy_crc_indication(struct nfapi_vnf_p7_config *config, nfapi_crc_indication_
}
if(index == -1){
LOG_E(MAC,"phy_crc_indication : num of crc reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
UL_RCC_INFO.crc_ind[index] = *ind;
@@ -603,6 +614,7 @@ int phy_rx_indication(struct nfapi_vnf_p7_config *config, nfapi_rx_indication_t
}
if(index == -1){
LOG_E(MAC,"phy_rx_indication : num of rx reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
UL_RCC_INFO.rx_ind[index] = *ind;
@@ -686,6 +698,7 @@ int phy_sr_indication(struct nfapi_vnf_p7_config *config, nfapi_sr_indication_t
}
if(index == -1){
LOG_E(MAC,"phy_sr_indication : num of sr reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
UL_RCC_INFO.sr_ind[index] = *ind;
@@ -737,6 +750,7 @@ int phy_cqi_indication(struct nfapi_vnf_p7_config *config, nfapi_cqi_indication_
}
if(index == -1){
LOG_E(MAC,"phy_cqi_indication : num of cqi reach max \n");
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
return 0;
}
UL_RCC_INFO.cqi_ind[index] = *ind;
@@ -170,6 +170,7 @@ typedef struct {
uint8_t prach_format;
/// Num RA
uint8_t num_ra;
uint8_t prach_slot;
uint8_t prach_start_symbol;
/// 38.211 (NCS 38.211 6.3.3.1).
uint16_t num_cs;
@@ -179,6 +180,8 @@ typedef struct {
uint8_t restricted_set;
/// see TS 38.211 (6.3.3.2).
uint16_t freq_msg1;
// When multiple SSBs per RO is configured, this indicates which one is selected in this RO -> this is used to properly compute the PRACH preamble
uint8_t ssb_nb_in_ro;
// nfapi_nr_ul_beamforming_t beamforming;
} fapi_nr_ul_config_prach_pdu;
@@ -321,6 +321,7 @@ typedef enum {
#define NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG 0x1012
#define NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG 0x1013
#define NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG 0x1014
#define NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG 0x1029
#define NFAPI_NR_CONFIG_PRACH_ROOT_SEQUENCE_INDEX_TAG 0x1015
#define NFAPI_NR_CONFIG_NUM_ROOT_SEQUENCES_TAG 0x1016
#define NFAPI_NR_CONFIG_K1_TAG 0x1017
@@ -385,7 +386,6 @@ typedef struct
typedef struct
{
uint8_t num_prach_fd_occasions;
nfapi_uint16_tlv_t prach_root_sequence_index;//Starting logical root sequence index, 𝑖, equivalent to higher layer parameter prach-RootSequenceIndex [38.211, sec 6.3.3.1] Value: 0 -> 837
nfapi_uint8_tlv_t num_root_sequences;//Number of root sequences for a particular FD occasion that are required to generate the necessary number of preambles
nfapi_uint16_tlv_t k1;//Frequency offset (from UL bandwidth part) for each FD. [38.211, sec 6.3.3.2] Value: from 0 to 272
@@ -401,7 +401,9 @@ typedef struct
nfapi_uint8_tlv_t prach_sub_c_spacing;//Subcarrier spacing of PRACH. [38.211 sec 4.2] Value:0->4
nfapi_uint8_tlv_t restricted_set_config;//PRACH restricted set config Value: 0: unrestricted 1: restricted set type A 2: restricted set type B
nfapi_uint8_tlv_t num_prach_fd_occasions;//Corresponds to the parameter 𝑀 in [38.211, sec 6.3.3.2] which equals the higher layer parameter msg1FDM Value: 1,2,4,8
nfapi_uint8_tlv_t prach_ConfigurationIndex;//PRACH configuration index. Value:0->255
nfapi_nr_num_prach_fd_occasions_t* num_prach_fd_occasions_list;
nfapi_uint8_tlv_t ssb_per_rach;//SSB-per-RACH-occasion Value: 0: 1/8 1:1/4, 2:1/2 3:1 4:2 5:4, 6:8 7:16
nfapi_uint8_tlv_t prach_multiple_carriers_in_a_band;//0 = disabled 1 = enabled
@@ -1258,7 +1260,7 @@ typedef struct
typedef struct
{
uint8_t pdu_idx;//This value is an index for number of PDU identified by nPDU in this message Value: 0 -> 65535
uint8_t pdu_idx;//This value is an index for number of PDU identified by nPDU in this message Value: 0 -> 255
} nfapi_nr_ul_tti_request_number_of_ue_t;
@@ -1539,7 +1541,7 @@ typedef struct
}nfapi_nr_uci_pucch_pdu_format_2_3_4_t;
typedef enum {
NFAPI_NR_UCI_PDCCH_PDU_TYPE = 0,
NFAPI_NR_UCI_PUSCH_PDU_TYPE = 0,
NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE = 1,
NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE = 2,
} nfapi_nr_uci_pdu_type_e;
+2 -2
View File
@@ -955,7 +955,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
NFAPI_TRACE(NFAPI_TRACE_NOTE, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
NFAPI_TRACE(NFAPI_TRACE_INFO, "(%4d/%1d) %d.%d PNF to VNF phy_id:%2d (t1/2/3/4:%8u, %8u, %8u, %8u) txrx:%4u procT:%3u latency(us):%4d(avg:%4d) offset(us):%8d filtered(us):%8d wrap[t1:%u t2:%u]\n",
NFAPI_SFNSF2SFN(phy->sfn_sf), NFAPI_SFNSF2SF(phy->sfn_sf), ts.tv_sec, ts.tv_nsec, ind.header.phy_id,
ind.t1, ind.t2, ind.t3, t4,
tx_2_rx, pnf_proc_time, latency, phy->average_latency, phy->sf_offset, phy->sf_offset_filtered,
@@ -1016,7 +1016,7 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7)
{
phy->adjustment = NFAPI_SFNSF2DEC(new_sfn_sf) - NFAPI_SFNSF2DEC(curr_sfn_sf);
NFAPI_TRACE(NFAPI_TRACE_NOTE, "PNF to VNF phy_id:%d adjustment%d phy->previous_sf_offset_filtered:%d phy->previous_sf_offset_filtered:%d phy->sf_offset_trend:%d\n", ind.header.phy_id, phy->adjustment, phy->previous_sf_offset_filtered, phy->previous_sf_offset_filtered, phy->sf_offset_trend);
NFAPI_TRACE(NFAPI_TRACE_INFO, "PNF to VNF phy_id:%d adjustment%d phy->previous_sf_offset_filtered:%d phy->previous_sf_offset_filtered:%d phy->sf_offset_trend:%d\n", ind.header.phy_id, phy->adjustment, phy->previous_sf_offset_filtered, phy->previous_sf_offset_filtered, phy->sf_offset_trend);
phy->previous_t1 = 0;
phy->previous_t2 = 0;
+1 -1
View File
@@ -260,7 +260,7 @@ crc6 (unsigned char * inptr, int bitlen)
}
if (resbit > 0)
crc = (crc << resbit) ^ (crc8Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 24);
crc = (crc << resbit) ^ (crc6Table[((*inptr) >> (8 - resbit)) ^ (crc >> (32 - resbit))] << 24);
return crc;
}
+5 -5
View File
@@ -121,13 +121,13 @@ int phy_init_RU(RU_t *ru) {
/* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */
//AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]),
//"nb_antennas_rx too large");
ru->prach_rxsigF = (int16_t **)malloc(ru->nb_rx * sizeof(int16_t *));
ru->prach_rxsigF[0] = (int16_t **)malloc(ru->nb_rx * sizeof(int16_t *));
for (j=0; j<4; j++) ru->prach_rxsigF_br[j] = (int16_t **)malloc(ru->nb_rx * sizeof(int16_t *));
for (i=0; i<ru->nb_rx; i++) {
ru->prach_rxsigF[i] = (int16_t *)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]);
ru->prach_rxsigF[0][i] = (int16_t *)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[0][i]);
for (j=0; j<4; j++) {
ru->prach_rxsigF_br[j][i] = (int16_t *)malloc16_clear( fp->ofdm_symbol_size*12*2*sizeof(int16_t) );
@@ -230,14 +230,14 @@ void phy_free_RU(RU_t *ru) {
}
for (i = 0; i < ru->nb_rx; i++) {
free_and_zero(ru->prach_rxsigF[i]);
free_and_zero(ru->prach_rxsigF[0][i]);
for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j][i]);
}
for (j = 0; j < 4; j++) free_and_zero(ru->prach_rxsigF_br[j]);
free_and_zero(ru->prach_rxsigF);
free_and_zero(ru->prach_rxsigF[0]);
/* ru->prach_rxsigF_br is not allocated -> don't free */
for (i = 0; i < RC.nb_L1_inst; i++) {
+20 -1
View File
@@ -181,9 +181,27 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB,
LOG_D(PHY,"Initializing PUSCH DMRS Gold sequence with (%x,%x)\n",Nid_pusch[0],Nid_pusch[1]);
nr_gold_pusch(gNB, &Nid_pusch[0]);
//CSI RS init
gNB->nr_gold_csi_rs = (uint32_t ***)malloc16(fp->slots_per_frame*sizeof(uint32_t **));
uint32_t ***csi_rs = gNB->nr_gold_csi_rs;
AssertFatal(csi_rs!=NULL, "NR init: csi reference signal malloc failed\n");
for (int slot=0; slot<fp->slots_per_frame; slot++) {
csi_rs[slot] = (uint32_t **)malloc16(fp->symbols_per_slot*sizeof(uint32_t *));
AssertFatal(csi_rs[slot]!=NULL, "NR init: csi reference signal for slot %d - malloc failed\n", slot);
for (int symb=0; symb<fp->symbols_per_slot; symb++) {
csi_rs[slot][symb] = (uint32_t *)malloc16(NR_MAX_CSI_RS_INIT_LENGTH_DWORD*sizeof(uint32_t));
AssertFatal(csi_rs[slot][symb]!=NULL, "NR init: csi reference signal for slot %d symbol %d - malloc failed\n", slot, symb);
}
}
nr_init_csi_rs(gNB, 0); // TODO scramblingID currently hardcoded to 0, to be taken from higher layer parameter scramblingID when implemented
/// Transport init necessary for NR synchro
init_nr_transport(gNB);
gNB->first_run_I0_measurements = 1;
common_vars->rxdata = (int32_t **)malloc16(Prx*sizeof(int32_t*));
@@ -497,11 +515,12 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) {
fd_occasion = 0;
nfapi_nr_prach_config_t *prach_config = &gNB_config->prach_config;
short_sequence = prach_config->prach_sequence_length.value;
// for(fd_occasion = 0; fd_occasion <= prach_config->num_prach_fd_occasions.value ; fd_occasion) { // TODO Need to handle for msg1-fdm > 1
num_sequences = prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value;
rootSequenceIndex = prach_config->num_prach_fd_occasions_list[fd_occasion].prach_root_sequence_index.value;
compute_nr_prach_seq(short_sequence, num_sequences, rootSequenceIndex, RC.gNB[Mod_id]->X_u);
// }
RC.gNB[Mod_id]->configured = 1;
init_symbol_rotation(fp,fp->dl_CarrierFreq);
+13 -9
View File
@@ -107,12 +107,14 @@ int nr_phy_init_RU(RU_t *ru) {
/* number of elements of an array X is computed as sizeof(X) / sizeof(X[0]) */
// AssertFatal(ru->nb_rx <= sizeof(ru->prach_rxsigF) / sizeof(ru->prach_rxsigF[0]),
// "nb_antennas_rx too large");
ru->prach_rxsigF = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
for (i=0; i<ru->nb_rx; i++) {
// largest size for PRACH FFT is 4x98304 (16*24576)
ru->prach_rxsigF[i] = (int16_t*)malloc16_clear( 4*98304*2*sizeof(int16_t) );
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[i]);
for (j=0;j<NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX;j++) {
ru->prach_rxsigF[j] = (int16_t**)malloc(ru->nb_rx * sizeof(int16_t*));
for (i=0; i<ru->nb_rx; i++) {
// largest size for PRACH FFT is 4x98304 (16*24576)
ru->prach_rxsigF[j][i] = (int16_t*)malloc16_clear( 4*98304*2*sizeof(int16_t) );
LOG_D(PHY,"[INIT] prach_vars->rxsigF[%d] = %p\n",i,ru->prach_rxsigF[j][i]);
}
}
AssertFatal(RC.nb_nr_L1_inst <= NUMBER_OF_eNB_MAX,"gNB instances %d > %d\n",
@@ -186,10 +188,12 @@ void nr_phy_free_RU(RU_t *ru)
for (i = 0; i < ru->nb_rx; i++) free_and_zero(ru->common.rxdataF[i]);
free_and_zero(ru->common.rxdataF);
for (i = 0; i < ru->nb_rx; i++) {
free_and_zero(ru->prach_rxsigF[i]);
for (j=0;j<NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX;j++) {
for (i = 0; i < ru->nb_rx; i++) {
free_and_zero(ru->prach_rxsigF[j][i]);
}
}
for (i = 0; i < RC.nb_nr_L1_inst; i++) {
for (p = 0; p < 15; p++) {
for (j=0; j<ru->nb_tx; j++) free_and_zero(ru->beam_weights[i][p][j]);
+1 -1
View File
@@ -400,7 +400,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
fp->Lmax = 64;
}
fp->L_ssb = (((uint64_t) config->ssb_table.ssb_mask_list[1].ssb_mask)<<32) | config->ssb_table.ssb_mask_list[1].ssb_mask;
fp->L_ssb = (((uint64_t) config->ssb_table.ssb_mask_list[0].ssb_mask)<<32) | config->ssb_table.ssb_mask_list[1].ssb_mask;
fp->N_ssb = 0;
for (int p=0; p<fp->Lmax; p++)
+2 -2
View File
@@ -49,7 +49,7 @@ void send_IF4p5(RU_t *ru,
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
int32_t **txdataF = ru->common.txdataF_BF;
int32_t **rxdataF = ru->common.rxdataF;
int16_t **prach_rxsigF = ru->prach_rxsigF;
int16_t **prach_rxsigF = ru->prach_rxsigF[0];
int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
void *tx_buffer = ru->ifbuffer.tx[subframe&1];
void *tx_buffer_prach = ru->ifbuffer.tx_prach;
@@ -276,7 +276,7 @@ void recv_IF4p5(RU_t *ru,
LTE_DL_FRAME_PARMS *fp = ru->frame_parms;
int32_t **txdataF = ru->common.txdataF_BF;
int32_t **rxdataF = ru->common.rxdataF;
int16_t **prach_rxsigF = ru->prach_rxsigF;
int16_t **prach_rxsigF = ru->prach_rxsigF[0];
int16_t ***prach_rxsigF_br = ru->prach_rxsigF_br;
void *rx_buffer = ru->ifbuffer.rx;
uint16_t element_id;
+1 -1
View File
@@ -167,7 +167,7 @@ void rx_prach0(PHY_VARS_eNB *eNB,
br_flag,ce_level,frame_prach,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex);
}
} else {
rxsigF = ru->prach_rxsigF;
rxsigF = ru->prach_rxsigF[0];
if (LOG_DEBUGFLAG(PRACH)) {
if (((frame_prach)&1023) < 20) LOG_I(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n",
+24 -1
View File
@@ -65,7 +65,7 @@ void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid)
for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) {
reset = 1;
x2 = ((1<<17) * (14*slot+symb+1) * ((Nid<<1)+1)) + (Nid<<1);
x2 = ((1<<17) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid<<1));
for (uint32_t n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) {
pdcch_dmrs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset);
@@ -130,3 +130,26 @@ void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid) {
}
}
}
void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid)
{
NR_DL_FRAME_PARMS *fp = &gNB->frame_parms;
uint32_t ***csi_rs = gNB->nr_gold_csi_rs;
uint32_t x1, x2;
uint8_t reset;
for (uint8_t slot=0; slot<fp->slots_per_frame; slot++) {
for (uint8_t symb=0; symb<fp->symbols_per_slot; symb++) {
reset = 1;
x2 = ((1<<10) * (fp->symbols_per_slot*slot+symb+1) * ((Nid<<1)+1) + (Nid));
for (uint32_t n=0; n<NR_MAX_PDCCH_DMRS_INIT_LENGTH_DWORD; n++) {
csi_rs[slot][symb][n] = lte_gold_generic(&x1, &x2, reset);
reset = 0;
}
}
}
}
+1
View File
@@ -38,6 +38,7 @@ void nr_init_pbch_dmrs(PHY_VARS_gNB* gNB);
*/
void nr_init_pdcch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid);
void nr_init_pdsch_dmrs(PHY_VARS_gNB* gNB, uint32_t Nid);
void nr_init_csi_rs(PHY_VARS_gNB* gNB, uint32_t Nid);
void nr_gold_pusch(PHY_VARS_gNB* gNB, uint32_t *Nid);
+608
View File
@@ -0,0 +1,608 @@
/*
* 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
*/
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/MODULATION/nr_modulation.h"
//#define NR_CSIRS_DEBUG
int nr_generate_csi_rs(uint32_t **gold_csi_rs,
int32_t** txdataF,
int16_t amp,
NR_DL_FRAME_PARMS frame_parms,
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params)
{
int16_t mod_csi[frame_parms.symbols_per_slot][NR_MAX_CSI_RS_LENGTH>>1];
uint16_t b = csi_params.freq_domain;
uint16_t n, csi_bw, csi_start, p, k, l, mprime, na, kpn, csi_length;
uint8_t size, ports, kprime, lprime, i, gs;
uint8_t j[16], k_n[6], koverline[16], loverline[16];
int found = 0;
int wf, wt, lp, kp, symb;
uint8_t fi = 0;
double rho, alpha;
uint32_t beta = amp;
AssertFatal(b!=0, "Invalid CSI frequency domain mapping: no bit selected in bitmap\n");
switch (csi_params.row) {
// implementation of table 7.4.1.5.3-1 of 38.211
// lprime and kprime are the max value of l' and k'
case 1:
ports = 1;
kprime = 0;
lprime = 0;
size = 3;
while (found < 1) {
if ((b >> fi) & 0x01) {
k_n[found] = fi;
found++;
}
else
fi++;
}
for (i=0; i<size; i++) {
j[i] = 0;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[0] + (i<<2);
}
break;
case 2:
ports = 1;
kprime = 0;
lprime = 0;
size = 1;
while (found < 1) {
if ((b >> fi) & 0x01) {
k_n[found] = fi;
found++;
}
else
fi++;
}
for (i=0; i<size; i++) {
j[i] = 0;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[0];
}
break;
case 3:
ports = 2;
kprime = 1;
lprime = 0;
size = 1;
while (found < 1) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
else
fi++;
}
for (i=0; i<size; i++) {
j[i] = 0;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[0];
}
break;
case 4:
ports = 4;
kprime = 1;
lprime = 0;
size = 2;
while (found < 1) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<2;
found++;
}
else
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[0] + (i<<1);
}
break;
case 5:
ports = 4;
kprime = 1;
lprime = 0;
size = 2;
while (found < 1) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
else
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0 + i;
koverline[i] = k_n[0];
}
break;
case 6:
ports = 8;
kprime = 1;
lprime = 0;
size = 4;
while (found < 4) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[i];
}
break;
case 7:
ports = 8;
kprime = 1;
lprime = 0;
size = 4;
while (found < 2) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0 + (i>>1);
koverline[i] = k_n[i%2];
}
break;
case 8:
ports = 8;
kprime = 1;
lprime = 1;
size = 2;
while (found < 2) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[i];
}
break;
case 9:
ports = 12;
kprime = 1;
lprime = 0;
size = 6;
while (found < 6) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[i];
}
break;
case 10:
ports = 12;
kprime = 1;
lprime = 1;
size = 3;
while (found < 3) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[i];
}
break;
case 11:
ports = 16;
kprime = 1;
lprime = 0;
size = 8;
while (found < 4) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0 + (i>>2);
koverline[i] = k_n[i%4];
}
break;
case 12:
ports = 16;
kprime = 1;
lprime = 1;
size = 4;
while (found < 4) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[i];
}
break;
case 13:
ports = 24;
kprime = 1;
lprime = 0;
size = 12;
while (found < 3) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
if (i<6)
loverline[i] = csi_params.symb_l0 + i/3;
else
loverline[i] = csi_params.symb_l1 + i/9;
koverline[i] = k_n[i%3];
}
break;
case 14:
ports = 24;
kprime = 1;
lprime = 1;
size = 6;
while (found < 3) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
if (i<3)
loverline[i] = csi_params.symb_l0;
else
loverline[i] = csi_params.symb_l1;
koverline[i] = k_n[i%3];
}
break;
case 15:
ports = 24;
kprime = 1;
lprime = 3;
size = 3;
while (found < 3) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[i];
}
break;
case 16:
ports = 32;
kprime = 1;
lprime = 0;
size = 16;
while (found < 4) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
if (i<8)
loverline[i] = csi_params.symb_l0 + (i>>2);
else
loverline[i] = csi_params.symb_l1 + (i/12);
koverline[i] = k_n[i%4];
}
break;
case 17:
ports = 32;
kprime = 1;
lprime = 1;
size = 8;
while (found < 4) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
if (i<4)
loverline[i] = csi_params.symb_l0;
else
loverline[i] = csi_params.symb_l1;
koverline[i] = k_n[i%4];
}
break;
case 18:
ports = 32;
kprime = 1;
lprime = 3;
size = 4;
while (found < 4) {
if ((b >> fi) & 0x01) {
k_n[found] = fi<<1;
found++;
}
fi++;
}
for (i=0; i<size; i++) {
j[i] = i;
loverline[i] = csi_params.symb_l0;
koverline[i] = k_n[i];
}
break;
default:
AssertFatal(0==1, "Row %d is not valid for CSI Table 7.4.1.5.3-1\n", csi_params.row);
}
#ifdef NR_CSIRS_DEBUG
printf(" row %d, n. of ports %d\n k' ",csi_params.row,ports);
for (kp=0; kp<=kprime; kp++)
printf("%d, ",kp);
printf("l' ");
for (lp=0; lp<=lprime; lp++)
printf("%d, ",lp);
printf("\n k overline ");
for (i=0; i<size; i++)
printf("%d, ",koverline[i]);
printf("\n l overline ");
for (i=0; i<size; i++)
printf("%d, ",loverline[i]);
printf("\n");
#endif
// setting the frequency density from its index
switch (csi_params.freq_density) {
case 0:
rho = 0.5;
break;
case 1:
rho = 0.5;
break;
case 2:
rho = 1;
break;
case 3:
rho = 3;
break;
default:
AssertFatal(0==1, "Invalid frequency density index for CSI\n");
}
if (ports == 1)
alpha = rho;
else
alpha = 2*rho;
#ifdef NR_CSIRS_DEBUG
printf(" rho %f, alpha %f\n",rho,alpha);
#endif
// CDM group size from CDM type index
switch (csi_params.cdm_type) {
case 0:
gs = 1;
break;
case 1:
gs = 2;
break;
case 2:
gs = 4;
break;
case 3:
gs = 8;
break;
default:
AssertFatal(0==1, "Invalid cdm type index for CSI\n");
}
// according to 38.214 5.2.2.3.1 last paragraph
if (csi_params.start_rb<csi_params.bwp_start)
csi_start = csi_params.bwp_start;
else
csi_start = csi_params.start_rb;
if (csi_params.nr_of_rbs > (csi_params.bwp_start+csi_params.bwp_size-csi_start))
csi_bw = csi_params.bwp_start+csi_params.bwp_size-csi_start;
else
csi_bw = csi_params.nr_of_rbs;
if (rho < 1) {
if (csi_params.freq_density == 0)
csi_length = (((csi_bw + csi_start)>>1)<<kprime)<<1;
else
csi_length = ((((csi_bw + csi_start)>>1)<<kprime)+1)<<1;
}
else
csi_length = (((uint16_t) rho*(csi_bw + csi_start))<<kprime)<<1;
#ifdef NR_CSIRS_DEBUG
printf(" start rb %d, n. rbs %d, csi length %d\n",csi_start,csi_bw,csi_length);
#endif
// TRS
if (csi_params.csi_type == 0) {
// ???
}
// NZP CSI RS
if (csi_params.csi_type == 1) {
// assuming amp is the amplitude of SSB channels
switch (csi_params.power_control_offset_ss) {
case 0:
beta = (amp*ONE_OVER_SQRT2_Q15)>>15;
break;
case 1:
beta = amp;
break;
case 2:
beta = (amp*ONE_OVER_SQRT2_Q15)>>14;
break;
case 3:
beta = amp<<1;
break;
default:
AssertFatal(0==1, "Invalid SS power offset density index for CSI\n");
}
for (lp=0; lp<=lprime; lp++){
symb = csi_params.symb_l0;
nr_modulation(gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]);
if ((csi_params.row == 5) || (csi_params.row == 7) || (csi_params.row == 11) || (csi_params.row == 13) || (csi_params.row == 16))
nr_modulation(gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]);
if ((csi_params.row == 14) || (csi_params.row == 13) || (csi_params.row == 16) || (csi_params.row == 17)) {
symb = csi_params.symb_l1;
nr_modulation(gold_csi_rs[symb+lp], csi_length, DMRS_MOD_ORDER, mod_csi[symb+lp]);
if ((csi_params.row == 13) || (csi_params.row == 16))
nr_modulation(gold_csi_rs[symb+1], csi_length, DMRS_MOD_ORDER, mod_csi[symb+1]);
}
}
}
uint16_t start_sc = frame_parms.first_carrier_offset;
// resource mapping according to 38.211 7.4.1.5.3
for (n=csi_start; n<(csi_start+csi_bw); n++) {
if ( (csi_params.freq_density > 1) || (csi_params.freq_density == (n%2))) { // for freq density 0.5 checks if even or odd RB
for (int ji=0; ji<size; ji++) { // loop over CDM groups
for (int s=0 ; s<gs; s++) { // loop over each CDM group size
p = s+j[ji]*gs; // port index
for (kp=0; kp<=kprime; kp++) { // loop over frequency resource elements within a group
k = (start_sc+(n*NR_NB_SC_PER_RB)+koverline[ji]+kp)%(frame_parms.ofdm_symbol_size); // frequency index of current resource element
// wf according to tables 7.4.5.3-2 to 7.4.5.3-5
if (kp == 0)
wf = 1;
else
wf = -2*(s%2)+1;
na = n*alpha;
kpn = (rho*koverline[ji])/NR_NB_SC_PER_RB;
mprime = na + kp + kpn; // sequence index
for (lp=0; lp<=lprime; lp++) { // loop over frequency resource elements within a group
l = lp + loverline[ji];
// wt according to tables 7.4.5.3-2 to 7.4.5.3-5
if (s < 2)
wt = 1;
else if (s < 4)
wt = -2*(lp%2)+1;
else if (s < 6)
wt = -2*(lp/2)+1;
else {
if ((lp == 0) || (lp == 3))
wt = 1;
else
wt = -1;
}
// ZP CSI RS
if (csi_params.csi_type == 2) {
((int16_t*)txdataF[p])[(l*frame_parms.ofdm_symbol_size + k)<<1] = 0;
((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = 0;
}
else {
((int16_t*)txdataF[p])[(l*frame_parms.ofdm_symbol_size + k)<<1] = (beta*wt*wf*mod_csi[l][mprime<<1]) >> 15;
((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1] = (beta*wt*wf*mod_csi[l][(mprime<<1) + 1]) >> 15;
}
#ifdef NR_CSIRS_DEBUG
printf("l,k (%d %d) seq. index %d \t port %d \t (%d,%d)\n",l,k-start_sc,mprime,p+3000,((int16_t*)txdataF[p])[(l*frame_parms.ofdm_symbol_size + k)<<1],
((int16_t*)txdataF[p])[((l*frame_parms.ofdm_symbol_size + k)<<1) + 1]);
#endif
}
}
}
}
}
}
return 0;
}
+26 -21
View File
@@ -64,37 +64,23 @@ void nr_pdcch_scrambling(uint32_t *in,
}
}
uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB,
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu,
nfapi_nr_dl_tti_pdcch_pdu *ul_dci_pdu,
uint32_t **gold_pdcch_dmrs,
int32_t *txdataF,
int16_t amp,
NR_DL_FRAME_PARMS frame_parms) {
void nr_generate_dci(PHY_VARS_gNB *gNB,
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15,
uint32_t **gold_pdcch_dmrs,
int32_t *txdataF,
int16_t amp,
NR_DL_FRAME_PARMS frame_parms) {
int16_t mod_dmrs[NR_MAX_CSET_DURATION][NR_MAX_PDCCH_DMRS_LENGTH>>1] __attribute__((aligned(16))); // 3 for the max coreset duration
uint16_t cset_start_sc;
uint8_t cset_start_symb, cset_nsymb;
int k,l,k_prime,dci_idx, dmrs_idx;
/*First iteration: single DCI*/
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu_rel15=NULL;
// find coreset descriptor
int rb_offset;
int n_rb;
AssertFatal(pdcch_pdu!=NULL || ul_dci_pdu!=NULL,"At least one pointer has to be !NULL\n");
AssertFatal(pdcch_pdu==NULL || ul_dci_pdu==NULL,"Can't handle both DL and UL DCI in same slot\n");
if (pdcch_pdu) pdcch_pdu_rel15 = &pdcch_pdu->pdcch_pdu_rel15;
else if (ul_dci_pdu) pdcch_pdu_rel15 = &ul_dci_pdu->pdcch_pdu_rel15;
nr_fill_cce_list(gNB,0,pdcch_pdu_rel15);
get_coreset_rballoc(pdcch_pdu_rel15->FreqDomainResource,&n_rb,&rb_offset);
@@ -241,6 +227,25 @@ uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB,
} // reg_idx
} // for (int d=0;d<pdcch_pdu_rel15->numDlDci;d++)
return 0;
}
void nr_generate_dci_top(PHY_VARS_gNB *gNB,
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu,
nfapi_nr_dl_tti_pdcch_pdu *ul_dci_pdu,
uint32_t **gold_pdcch_dmrs,
int32_t *txdataF,
int16_t amp,
NR_DL_FRAME_PARMS frame_parms) {
AssertFatal(pdcch_pdu!=NULL || ul_dci_pdu!=NULL,"At least one pointer has to be !NULL\n");
if (pdcch_pdu && ul_dci_pdu) {
nr_generate_dci(gNB,&pdcch_pdu->pdcch_pdu_rel15,gold_pdcch_dmrs,txdataF,amp,frame_parms);
nr_generate_dci(gNB,&ul_dci_pdu->pdcch_pdu_rel15,gold_pdcch_dmrs,txdataF,amp,frame_parms);
}
else if (pdcch_pdu)
nr_generate_dci(gNB,&pdcch_pdu->pdcch_pdu_rel15,gold_pdcch_dmrs,txdataF,amp,frame_parms);
else
nr_generate_dci(gNB,&ul_dci_pdu->pdcch_pdu_rel15,gold_pdcch_dmrs,txdataF,amp,frame_parms);
}
+1 -1
View File
@@ -29,7 +29,7 @@ uint16_t nr_get_dci_size(nfapi_nr_dci_format_e format,
nfapi_nr_rnti_type_e rnti_type,
uint16_t N_RB);
uint8_t nr_generate_dci_top(PHY_VARS_gNB *gNB,
void nr_generate_dci_top(PHY_VARS_gNB *gNB,
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu,
nfapi_nr_dl_tti_pdcch_pdu *ul_pdcch_pdu,
uint32_t **gold_pdcch_dmrs,
+90 -65
View File
@@ -37,31 +37,42 @@
extern uint16_t prach_root_sequence_map_0_3[838];
extern uint16_t prach_root_sequence_map_abc[138];
extern uint16_t nr_du[838];
extern const char *prachfmt[9];
extern const char *prachfmt[];
void init_prach_list(PHY_VARS_gNB *gNB) {
AssertFatal(gNB!=NULL,"gNB is null\n");
for (int i=0; i<NUMBER_OF_NR_PRACH_MAX; i++) gNB->prach_vars.list[i].frame=-1;
for (int i=0; i<NUMBER_OF_NR_PRACH_MAX; i++){
gNB->prach_vars.list[i].frame = -1;
gNB->prach_vars.list[i].slot = -1;
}
}
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, int numRA, find_type_t type) {
void free_nr_prach_entry(PHY_VARS_gNB *gNB, int prach_id) {
uint16_t i;
int16_t first_free_index=-1;
gNB->prach_vars.list[prach_id].frame = -1;
gNB->prach_vars.list[prach_id].slot = -1;
}
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame, int slot, find_type_t type) {
AssertFatal(gNB!=NULL,"gNB is null\n");
for (i=0; i<NUMBER_OF_NR_PRACH_MAX; i++) {
LOG_D(PHY,"searching for PRACH in %d.%d with numRA %d: prach_index %d=> %d.%d numRA %d\n", frame,slot,numRA,i,
gNB->prach_vars.list[i].frame,gNB->prach_vars.list[i].slot,gNB->prach_vars.list[i].pdu.num_ra);
if ((gNB->prach_vars.list[i].frame == frame) &&
(gNB->prach_vars.list[i].slot == slot) &&
(gNB->prach_vars.list[i].pdu.num_ra == numRA)) return i;
else if ((gNB->prach_vars.list[i].frame == -1) && (first_free_index==-1)) first_free_index=i;
for (uint16_t i=0; i<NUMBER_OF_NR_PRACH_MAX; i++) {
LOG_D(PHY,"searching for PRACH in %d.%d prach_index %d=> %d.%d\n", frame,slot,i,
gNB->prach_vars.list[i].frame,gNB->prach_vars.list[i].slot);
if((type == SEARCH_EXIST_OR_FREE) &&
(gNB->prach_vars.list[i].frame == -1) &&
(gNB->prach_vars.list[i].slot == -1)) {
return i;
}
else if ((type == SEARCH_EXIST) &&
(gNB->prach_vars.list[i].frame == frame) &&
(gNB->prach_vars.list[i].slot == slot)) {
return i;
}
}
if (type == SEARCH_EXIST) return -1;
return first_free_index;
return -1;
}
void nr_fill_prach(PHY_VARS_gNB *gNB,
@@ -69,9 +80,9 @@ void nr_fill_prach(PHY_VARS_gNB *gNB,
int Slot,
nfapi_nr_prach_pdu_t *prach_pdu) {
int prach_id = find_nr_prach(gNB,SFN,Slot,prach_pdu->num_ra,SEARCH_EXIST_OR_FREE);
AssertFatal( (prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX),
"illegal or no prach_id found!!! numRA %d prach_id %d\n",prach_pdu->num_ra,prach_id);
int prach_id = find_nr_prach(gNB,SFN,Slot,SEARCH_EXIST_OR_FREE);
AssertFatal( ((prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX)) || (prach_id < 0),
"illegal or no prach_id found!!! prach_id %d\n",prach_id);
gNB->prach_vars.list[prach_id].frame=SFN;
gNB->prach_vars.list[prach_id].slot=Slot;
@@ -82,31 +93,35 @@ void nr_fill_prach(PHY_VARS_gNB *gNB,
void init_prach_ru_list(RU_t *ru) {
AssertFatal(ru!=NULL,"ruis null\n");
for (int i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) ru->prach_list[i].frame=-1;
for (int i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) {
ru->prach_list[i].frame = -1;
ru->prach_list[i].slot = -1;
}
pthread_mutex_init(&ru->prach_list_mutex,NULL);
}
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type) {
uint16_t i;
int16_t first_free_index=-1;
AssertFatal(ru!=NULL,"ru is null\n");
pthread_mutex_lock(&ru->prach_list_mutex);
for (i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) {
for (uint16_t i=0; i<NUMBER_OF_NR_RU_PRACH_MAX; i++) {
LOG_D(PHY,"searching for PRACH in %d.%d : prach_index %d=> %d.%d\n", frame,slot,i,
ru->prach_list[i].frame,ru->prach_list[i].slot);
if ((ru->prach_list[i].frame == frame) &&
(ru->prach_list[i].slot == slot)) {
if((type == SEARCH_EXIST_OR_FREE) &&
(ru->prach_list[i].frame == -1) &&
(ru->prach_list[i].slot == -1)) {
pthread_mutex_unlock(&ru->prach_list_mutex);
return i;
}
else if ((type == SEARCH_EXIST) &&
(ru->prach_list[i].frame == frame) &&
(ru->prach_list[i].slot == slot)) {
pthread_mutex_unlock(&ru->prach_list_mutex);
return i;
}
else if ((ru->prach_list[i].frame == -1) && (first_free_index==-1)) first_free_index=i;
}
pthread_mutex_unlock(&ru->prach_list_mutex);
if (type == SEARCH_EXIST) return -1;
return first_free_index;
return -1;
}
void nr_fill_prach_ru(RU_t *ru,
@@ -115,7 +130,7 @@ void nr_fill_prach_ru(RU_t *ru,
nfapi_nr_prach_pdu_t *prach_pdu) {
int prach_id = find_nr_prach_ru(ru,SFN,Slot,SEARCH_EXIST_OR_FREE);
AssertFatal( (prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX),
AssertFatal( ((prach_id>=0) && (prach_id<NUMBER_OF_NR_PRACH_MAX)) || (prach_id < 0) ,
"illegal or no prach_id found!!! prach_id %d\n",prach_id);
pthread_mutex_lock(&ru->prach_list_mutex);
@@ -124,6 +139,7 @@ void nr_fill_prach_ru(RU_t *ru,
ru->prach_list[prach_id].fmt = prach_pdu->prach_format;
ru->prach_list[prach_id].numRA = prach_pdu->num_ra;
ru->prach_list[prach_id].prachStartSymbol = prach_pdu->prach_start_symbol;
ru->prach_list[prach_id].num_prach_ocas = prach_pdu->num_prach_ocas;
pthread_mutex_unlock(&ru->prach_list_mutex);
}
@@ -132,7 +148,8 @@ void free_nr_ru_prach_entry(RU_t *ru,
int prach_id) {
pthread_mutex_lock(&ru->prach_list_mutex);
ru->prach_list[prach_id].frame=-1;
ru->prach_list[prach_id].frame = -1;
ru->prach_list[prach_id].slot = -1;
pthread_mutex_unlock(&ru->prach_list_mutex);
}
@@ -142,6 +159,7 @@ void rx_nr_prach_ru(RU_t *ru,
int prachFormat,
int numRA,
int prachStartSymbol,
int prachOccasion,
int frame,
int slot) {
@@ -156,15 +174,21 @@ void rx_nr_prach_ru(RU_t *ru,
int msg1_frequencystart = ru->config.prach_config.num_prach_fd_occasions_list[numRA].k1.value;
rxsigF = ru->prach_rxsigF;
int sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1));
//to be checked for mu=0;
LOG_D(PHY,"frame %d, slot %d: doing rx_nr_prach_ru for format %d, numRA %d, prachStartSymbol %d, prachOccasion %d\n",frame,slot,prachFormat,numRA,prachStartSymbol,prachOccasion);
rxsigF = ru->prach_rxsigF[prachOccasion];
AssertFatal(ru->if_south == LOCAL_RF,"we shouldn't call this if if_south != LOCAL_RF\n");
for (int aa=0; aa<ru->nb_rx; aa++){
if (prach_sequence_length == 0) slot2=(slot/fp->slots_per_subframe)*fp->slots_per_subframe;
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(slot2*fp->get_samples_per_slot(slot,fp))-ru->N_TA_offset];
prach[aa] = (int16_t*)&ru->common.rxdata[aa][(slot2*fp->get_samples_per_slot(slot,fp))+sample_offset_slot-ru->N_TA_offset];
}
int dftlen=0;
int mu = fp->numerology_index;
int Ncp = 0;
@@ -198,22 +222,24 @@ void rx_nr_prach_ru(RU_t *ru,
ru->idx,frame,slot,prachfmt[prachFormat],msg1_frequencystart,prachStartSymbol);
switch (prachFormat) {
case 0: //A1
case 4: //A1
Ncp = 288/(1<<mu);
break;
case 1: //A2
case 5: //A2
Ncp = 576/(1<<mu);
break;
case 2: //A3
case 6: //A3
Ncp = 864/(1<<mu);
break;
case 3: //B1
case 7: //B1
Ncp = 216/(1<<mu);
break;
/*
// B2 and B3 do not exist in FAPI
case 4: //B2
Ncp = 360/(1<<mu);
break;
@@ -221,16 +247,16 @@ void rx_nr_prach_ru(RU_t *ru,
case 5: //B3
Ncp = 504/(1<<mu);
break;
case 6: //B4
*/
case 8: //B4
Ncp = 936/(1<<mu);
break;
case 7: //C0
case 9: //C0
Ncp = 1240/(1<<mu);
break;
case 8: //C2
case 10: //C2
Ncp = 2048/(1<<mu);
break;
@@ -265,7 +291,8 @@ void rx_nr_prach_ru(RU_t *ru,
if (k<0) k+=(fp->ofdm_symbol_size);
k*=K;
k+=kbar;
k+=kbar;
int reps=1;
for (int aa=0; aa<ru->nb_rx; aa++) {
@@ -308,21 +335,21 @@ void rx_nr_prach_ru(RU_t *ru,
else if (mu==1) {
dftlen=2048;
dft(DFT_2048,prach2,rxsigF[aa],1);
if (prachFormat != 7) { // !=C0
if (prachFormat != 9/*C0*/) {
dft(DFT_2048,prach2+4096,rxsigF[aa]+4096,1);
reps++;
}
if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) {
if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) {
dft(DFT_2048,prach2+4096*2,rxsigF[aa]+4096*2,1);
dft(DFT_2048,prach2+4096*3,rxsigF[aa]+4096*3,1);
reps+=2;
}
if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) {
if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) {
dft(DFT_2048,prach2+4096*4,rxsigF[aa]+4096*4,1);
dft(DFT_2048,prach2+4096*5,rxsigF[aa]+4096*5,1);
reps+=2;
}
if (prachFormat == 6) {
if (prachFormat == 8/*B4*/) {
for (int i=6;i<12;i++) dft(DFT_2048,prach2+(4096*i),rxsigF[aa]+(4096*i),1);
reps+=6;
}
@@ -363,22 +390,22 @@ void rx_nr_prach_ru(RU_t *ru,
else if (mu==1) {
dftlen=1536;
dft(DFT_1536,prach2,rxsigF[aa],1);
if (prachFormat != 7) {
if (prachFormat != 9/*C0*/) {
dft(DFT_1536,prach2+3072,rxsigF[aa]+3072,1);
reps++;
}
if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) {
if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) {
dft(DFT_1536,prach2+3072*2,rxsigF[aa]+3072*2,1);
dft(DFT_1536,prach2+3072*3,rxsigF[aa]+3072*3,1);
reps+=2;
}
if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) {
if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) {
dft(DFT_1536,prach2+3072*4,rxsigF[aa]+3072*4,1);
dft(DFT_1536,prach2+3072*5,rxsigF[aa]+3072*5,1);
reps+=2;
}
if (prachFormat == 6) {
if (prachFormat == 8/*B4*/) {
for (int i=6;i<12;i++) dft(DFT_1536,prach2+(3072*i),rxsigF[aa]+(3072*i),1);
reps+=6;
}
@@ -423,22 +450,22 @@ void rx_nr_prach_ru(RU_t *ru,
else if (mu==1) {
dftlen=4096;
dft(DFT_4096,prach2,rxsigF[aa],1);
if (prachFormat != 7) { //!=C0
if (prachFormat != 9/*C0*/) {
dft(DFT_4096,prach2+8192,rxsigF[aa]+8192,1);
reps++;
}
if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) {
if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) {
dft(DFT_4096,prach2+8192*2,rxsigF[aa]+8192*2,1);
dft(DFT_4096,prach2+8192*3,rxsigF[aa]+8192*3,1);
reps+=2;
}
if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) {
if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) {
dft(DFT_4096,prach2+8192*4,rxsigF[aa]+8192*4,1);
dft(DFT_4096,prach2+8192*5,rxsigF[aa]+8192*5,1);
reps+=2;
}
if (prachFormat == 6) {
if (prachFormat == 8/*B4*/) {
for (int i=6;i<12;i++) dft(DFT_4096,prach2+(8192*i),rxsigF[aa]+(8192*i),1);
reps+=6;
}
@@ -475,22 +502,22 @@ void rx_nr_prach_ru(RU_t *ru,
else if (mu==1) {
dftlen=3072;
dft(DFT_3072,prach2,rxsigF[aa],1);
if (prachFormat != 7) { //!=C0
if (prachFormat != 9/*C0*/) {
dft(DFT_3072,prach2+6144,rxsigF[aa]+6144,1);
reps++;
}
if (prachFormat == 1 || prachFormat == 2 || prachFormat == 4 || prachFormat == 5 || prachFormat == 6 || prachFormat == 8) {
if (prachFormat == 5/*A2*/ || prachFormat == 6/*A3*/|| prachFormat == 8/*B4*/ || prachFormat == 10/*C2*/) {
dft(DFT_3072,prach2+6144*2,rxsigF[aa]+6144*2,1);
dft(DFT_3072,prach2+6144*3,rxsigF[aa]+6144*3,1);
reps+=2;
}
if (prachFormat == 2 || prachFormat == 5 || prachFormat == 6) {
if (prachFormat == 6/*A3*/ || prachFormat == 8/*B4*/) {
dft(DFT_3072,prach2+6144*4,rxsigF[aa]+6144*4,1);
dft(DFT_3072,prach2+6144*5,rxsigF[aa]+6144*5,1);
reps+=2;
}
if (prachFormat == 6) {
if (prachFormat == 8/*B4*/) {
for (int i=6;i<12;i++) dft(DFT_3072,prach2+(6144*i),rxsigF[aa]+(6144*i),1);
reps+=6;
}
@@ -515,13 +542,13 @@ void rx_nr_prach_ru(RU_t *ru,
for (int i=1;i<reps;i++) rxsigF_tmp[j] += rxsigF2[k2+(i*dftlen<<1)];
}
memcpy((void*)rxsigF2,(void *)rxsigF_tmp,N_ZC<<2);
}
}
void rx_nr_prach(PHY_VARS_gNB *gNB,
nfapi_nr_prach_pdu_t *prach_pdu,
int prachOccasion,
int frame,
int subframe,
uint16_t *max_preamble,
@@ -570,13 +597,11 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
fp = &gNB->frame_parms;
nb_rx = gNB->gNB_config.carrier_config.num_rx_ant.value;
rootSequenceIndex = cfg->num_prach_fd_occasions_list[0].prach_root_sequence_index.value;
numrootSequenceIndex = cfg->num_prach_fd_occasions_list[0].num_root_sequences.value;
rootSequenceIndex = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].prach_root_sequence_index.value;
numrootSequenceIndex = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].num_root_sequences.value;
NCS = prach_pdu->num_cs;//cfg->num_prach_fd_occasions_list[0].prach_zero_corr_conf.value;
int prach_sequence_length = cfg->prach_sequence_length.value;
int msg1_frequencystart = cfg->num_prach_fd_occasions_list[0].k1.value;
int msg1_frequencystart = cfg->num_prach_fd_occasions_list[prach_pdu->num_ra].k1.value;
// int num_unused_root_sequences = cfg->num_prach_fd_occasions_list[0].num_unused_root_sequences.value;
// cfg->num_prach_fd_occasions_list[0].unused_root_sequences_list
@@ -585,7 +610,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB,
uint8_t prach_fmt = prach_pdu->prach_format;
uint16_t N_ZC = (prach_sequence_length==0)?839:139;
LOG_D(PHY,"L1 PRACH RX: rooSequenceIndex %d, numRootSeqeuences %d, NCS %d, N_ZC %d \n", rootSequenceIndex,numrootSequenceIndex,NCS,N_ZC);
LOG_D(PHY,"L1 PRACH RX: rooSequenceIndex %d, numRootSeqeuences %d, NCS %d, N_ZC %d, format %d \n",rootSequenceIndex,numrootSequenceIndex,NCS,N_ZC,prach_fmt);
prach_ifft = gNB->prach_vars.prach_ifft;
prachF = gNB->prach_vars.prachF;
+15 -1
View File
@@ -288,6 +288,7 @@ void nr_fill_prach(PHY_VARS_gNB *gNB,
void rx_nr_prach(PHY_VARS_gNB *gNB,
nfapi_nr_prach_pdu_t *prach_pdu,
int prachOccasion,
int frame,
int subframe,
uint16_t *max_preamble,
@@ -298,6 +299,7 @@ void rx_nr_prach_ru(RU_t *ru,
int prach_fmt,
int numRA,
int prachStartSymbol,
int prachOccasion,
int frame,
int subframe);
@@ -306,7 +308,7 @@ void nr_fill_prach_ru(RU_t *ru,
int Slot,
nfapi_nr_prach_pdu_t *prach_pdu);
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, int numRA, find_type_t type);
int16_t find_nr_prach(PHY_VARS_gNB *gNB,int frame,int slot, find_type_t type);
int16_t find_nr_prach_ru(RU_t *ru,int frame,int slot, find_type_t type);
NR_gNB_PUCCH_t *new_gNB_pucch(void);
@@ -326,6 +328,13 @@ void init_prach_list(PHY_VARS_gNB *gNB);
void init_prach_ru_list(RU_t *ru);
void free_nr_ru_prach_entry(RU_t *ru, int prach_id);
int nr_generate_csi_rs(uint32_t **gold_csi_rs,
int32_t **txdataF,
int16_t amp,
NR_DL_FRAME_PARMS frame_parms,
nfapi_nr_dl_tti_csi_rs_pdu_rel15_t csi_params);
void free_nr_prach_entry(PHY_VARS_gNB *gNB, int prach_id);
void nr_decode_pucch1(int32_t **rxdataF,
pucch_GroupHopping_t pucch_GroupHopping,
@@ -352,5 +361,10 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu);
void nr_decode_pucch2(PHY_VARS_gNB *gNB,
int slot,
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu);
#endif /*__NR_TRANSPORT__H__*/
@@ -478,7 +478,12 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
NR_gNB_ULSCH_t *ulsch = phy_vars_gNB->ulsch[UE_id][0];
NR_UL_gNB_HARQ_t *harq_process = ulsch->harq_processes[harq_pid];
if (!harq_process) {
LOG_E(PHY,"ulsch_decoding.c: NULL harq_process pointer\n");
return 1;
}
t_nrLDPC_dec_params decParams;
t_nrLDPC_dec_params* p_decParams = &decParams;
@@ -488,11 +493,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB,
phy_vars_gNB->nbDecode = 0;
harq_process->processedSegments = 0;
if (!harq_process) {
LOG_E(PHY,"ulsch_decoding.c: NULL harq_process pointer\n");
return 1;
}
double Coderate = 0.0;
// ------------------------------------------------------------------
@@ -1136,8 +1136,8 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
rel15_ul);
for (aarx = 0; aarx < frame_parms->nb_antennas_rx; aarx++) {
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size],
rel15_ul->rb_size*12);
gNB->pusch_vars[ulsch_id]->ulsch_power[aarx] = signal_energy_nodc(&gNB->pusch_vars[ulsch_id]->ul_ch_estimates[aarx][symbol*frame_parms->ofdm_symbol_size],
rel15_ul->rb_size*12);
if (gNB->pusch_vars[ulsch_id]->ulsch_power[aarx]==1) return (1);
}
+75 -99
View File
@@ -96,7 +96,6 @@ void nr_fill_pucch(PHY_VARS_gNB *gNB,
pucch->slot = slot;
pucch->active = 1;
memcpy((void*)&pucch->pucch_pdu, (void*)pucch_pdu, sizeof(nfapi_nr_pucch_pdu_t));
}
@@ -166,7 +165,6 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
nfapi_nr_uci_pucch_pdu_format_0_1_t* uci_pdu,
nfapi_nr_pucch_pdu_t* pucch_pdu) {
int32_t **rxdataF = gNB->common_vars.rxdataF;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
@@ -381,7 +379,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
#endif
// estimate CQI for MAC (from antenna port 0 only)
int SNRtimes10 = dB_fixed_times10(signal_energy(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset],12)) - (10*gNB->measurements.n0_power_tot_dB);
int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset],12)) - (10*gNB->measurements.n0_power_tot_dB);
int cqi;
if (SNRtimes10 < -640) cqi=0;
else if (SNRtimes10 > 635) cqi=255;
@@ -395,9 +393,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
// first bit of bitmap for sr presence and second bit for acknack presence
uci_pdu->pduBitmap = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1);
uci_pdu->pucch_format = 0; // format 0
uci_pdu->ul_cqi = cqi; // currently not valid
uci_pdu->ul_cqi = cqi;
uci_pdu->timing_advance = 0xffff; // currently not valid
uci_pdu->rssi = 1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset],12)));
uci_pdu->rssi = 1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset],12)));
if (pucch_pdu->bit_len_harq==0) {
uci_pdu->harq = NULL;
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
@@ -414,8 +412,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0;
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
LOG_D(PHY, "HARQ value %d with confidence level (0 is good, 1 is bad) %d\n",
uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level);
LOG_I(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d\n",
slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level);
if (pucch_pdu->sr_flag == 1) {
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
uci_pdu->sr->sr_indication = (index>1) ? 1 : 0;
@@ -429,8 +427,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2);
uci_pdu->harq->harq_list[1].harq_value = index&0x01;
uci_pdu->harq->harq_list[0].harq_value = (index>>1)&0x01;
LOG_D(PHY, "HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d\n",
uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level);
LOG_I(PHY, "Slot %d HARQ values %d and %d with confidence level (0 is good, 1 is bad) %d\n",
slot,uci_pdu->harq->harq_list[1].harq_value,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level);
if (pucch_pdu->sr_flag == 1) {
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
uci_pdu->sr->sr_indication = (index>3) ? 1 : 0;
@@ -1091,11 +1089,12 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
//pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1);
AssertFatal(pucch_pdu->nr_of_symbols==1 || pucch_pdu->nr_of_symbols==2,
"Illegal number of symbols for PUCCH 2 %d\n",pucch_pdu->nr_of_symbols);
AssertFatal((pucch_pdu->prb_start-((pucch_pdu->prb_start>>2)<<2))==0,
"Current pucch2 receiver implementation requires a PRB offset multiple of 4. The one selected is %d",
pucch_pdu->prb_start);
//extract pucch and dmrs first
@@ -1118,10 +1117,24 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
int16_t rd_im_ext[Prx2][4*pucch_pdu->nr_of_symbols*pucch_pdu->prb_size] __attribute__((aligned(32)));
int16_t *r_re_ext_p,*r_im_ext_p,*rd_re_ext_p,*rd_im_ext_p;
int16_t *rp[Prx2];
int nb_re_pucch = 12*pucch_pdu->prb_size;
int16_t rp[Prx2][nb_re_pucch*2],*tmp_rp;
__m64 dmrs_re,dmrs_im;
for (int aa=0;aa<Prx;aa++) rp[aa] = ((int16_t *)&rxdataF[aa][(l2*frame_parms->ofdm_symbol_size)+re_offset]);
for (int aa=0;aa<Prx;aa++){
tmp_rp = ((int16_t *)&rxdataF[aa][l2*frame_parms->ofdm_symbol_size]);
if (re_offset + nb_re_pucch < frame_parms->ofdm_symbol_size) {
memcpy1((void*)rp[aa],(void*)&tmp_rp[re_offset*2],nb_re_pucch*sizeof(int32_t));
}
else {
int neg_length = frame_parms->ofdm_symbol_size-re_offset;
int pos_length = nb_re_pucch-neg_length;
memcpy1((void*)rp[aa],(void*)&tmp_rp[re_offset*2],neg_length*sizeof(int32_t));
memcpy1((void*)&rp[aa][neg_length*2],(void*)tmp_rp,pos_length*sizeof(int32_t));
}
}
#ifdef DEBUG_NR_PUCCH_RX
printf("Decoding pucch2 for %d symbols, %d PRB\n",pucch_pdu->nr_of_symbols,pucch_pdu->prb_size);
@@ -1142,67 +1155,19 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
rd_re_ext_p=&rd_re_ext[aa][4*prb];
rd_im_ext_p=&rd_im_ext[aa][4*prb];
r_re_ext_p[0]=rp[aa][0];
r_im_ext_p[0]=rp[aa][1];
rd_re_ext_p[0]=rp[aa][2];
rd_im_ext_p[0]=rp[aa][3];
r_re_ext_p[1]=rp[aa][4];
r_im_ext_p[1]=rp[aa][5];
r_re_ext_p[2]=rp[aa][6];
r_im_ext_p[2]=rp[aa][7];
rd_re_ext_p[1]=rp[aa][8];
rd_im_ext_p[1]=rp[aa][9];
r_re_ext_p[3]=rp[aa][10];
r_im_ext_p[3]=rp[aa][11];
r_re_ext_p[4]=rp[aa][12];
r_im_ext_p[4]=rp[aa][13];
rd_re_ext_p[2]=rp[aa][14];
rd_im_ext_p[2]=rp[aa][15];
r_re_ext_p[5]=rp[aa][16];
r_im_ext_p[5]=rp[aa][17];
r_re_ext_p[6]=rp[aa][18];
r_im_ext_p[6]=rp[aa][19];
rd_re_ext_p[3]=rp[aa][20];
rd_im_ext_p[3]=rp[aa][21];
r_re_ext_p[7]=rp[aa][22];
r_im_ext_p[7]=rp[aa][23];
r_re_ext_p[8]=rp[aa][24];
r_im_ext_p[8]=rp[aa][25];
rd_re_ext_p[4]=rp[aa][26];
rd_im_ext_p[4]=rp[aa][27];
r_re_ext_p[9]=rp[aa][28];
r_im_ext_p[9]=rp[aa][29];
r_re_ext_p[10]=rp[aa][30];
r_im_ext_p[10]=rp[aa][31];
rd_re_ext_p[5]=rp[aa][32];
rd_im_ext_p[5]=rp[aa][33];
r_re_ext_p[11]=rp[aa][34];
r_im_ext_p[11]=rp[aa][35];
r_re_ext_p[12]=rp[aa][36];
r_im_ext_p[12]=rp[aa][37];
rd_re_ext_p[6]=rp[aa][38];
rd_im_ext_p[6]=rp[aa][39];
r_re_ext_p[13]=rp[aa][40];
r_im_ext_p[13]=rp[aa][41];
r_re_ext_p[14]=rp[aa][42];
r_im_ext_p[14]=rp[aa][43];
rd_re_ext_p[7]=rp[aa][44];
rd_im_ext_p[7]=rp[aa][45];
r_re_ext_p[15]=rp[aa][46];
r_im_ext_p[15]=rp[aa][47];
for (int idx=0; idx<8; idx++) {
r_re_ext_p[idx<<1]=rp[aa][prb*24+6*idx];
r_im_ext_p[idx<<1]=rp[aa][prb*24+1+6*idx];
rd_re_ext_p[idx]=rp[aa][prb*24+2+6*idx];
rd_im_ext_p[idx]=rp[aa][prb*24+3+6*idx];
r_re_ext_p[1+(idx<<1)]=rp[aa][prb*24+4+6*idx];
r_im_ext_p[1+(idx<<1)]=rp[aa][prb*24+5+6*idx];
}
#ifdef DEBUG_NR_PUCCH_RX
for (int i=0;i<8;i++) printf("Ant %d PRB %d dmrs[%d] -> (%d,%d)\n",aa,prb+(i>>2),i,rd_re_ext_p[i],rd_im_ext_p[i]);
for (int i=0;i<16;i++) printf("Ant %d PRB %d data[%d] -> (%d,%d)\n",aa,prb+(i>>3),i,r_re_ext_p[i],r_im_ext_p[i]);
#endif
rp[aa]+=48;
} // aa
} // prb
@@ -1214,7 +1179,11 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
printf("slot %d, start_symbol_index %d, dmrs_scrambling_id %d\n",
slot,pucch_pdu->start_symbol_index,pucch_pdu->dmrs_scrambling_id);
#endif
s = lte_gold_generic(&x1, &x2, 1);
int reset = 1;
for (int i=0; i<=(pucch_pdu->prb_start>>2); i++) {
s = lte_gold_generic(&x1, &x2, reset);
reset = 0;
}
for (int group=0;group<ngroup;group++) {
// each group has 8*nc_group_size elements, compute 1 complex correlation with DMRS per group
@@ -1476,7 +1445,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
for (int aa=0;aa<Prx;aa++) {
LOG_D(PHY,"pucch2 cw %d group %d aa %d: (%d,%d)+(%d,%d) = (%d,%d)\n",cw,group,aa,
corr32_re[group][aa],corr32_im[0][aa],
corr32_re[group][aa],corr32_im[group][aa],
((int16_t*)(&prod_re[aa]))[0],
((int16_t*)(&prod_im[aa]))[0],
corr32_re[group][aa]+((int16_t*)(&prod_re[aa]))[0],
@@ -1495,7 +1464,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
}
} // cw loop
corr_dB = dB_fixed64((uint64_t)corr);
LOG_D(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB);
LOG_I(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB);
decodedPayload[0]=(uint64_t)cw_ML;
}
else { // polar coded case
@@ -1554,24 +1523,24 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
corr_re = ( corr32_re[half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_re[aa]))[0]);
corr_im = ( corr32_im[half_prb>>2][aa]/(2*nc_group_size*4/2)+((int16_t*)(&prod_im[aa]))[0]);
corr_tmp += corr_re*corr_re + corr_im*corr_im;
/*
LOG_D(PHY,"pucch2 half_prb %d cw %d (%d,%d) aa %d: (%d,%d,%d,%d,%d,%d,%d,%d)x(%d,%d,%d,%d,%d,%d,%d,%d) (%d,%d)+(%d,%d) = (%d,%d) => %d\n",
half_prb,cw,cw&15,cw>>4,aa,
((int16_t*)&pucch2_polar_4bit[cw&15])[0],((int16_t*)&pucch2_polar_4bit[cw>>4])[0],
((int16_t*)&pucch2_polar_4bit[cw&15])[1],((int16_t*)&pucch2_polar_4bit[cw>>4])[1],
((int16_t*)&pucch2_polar_4bit[cw&15])[2],((int16_t*)&pucch2_polar_4bit[cw>>4])[2],
((int16_t*)&pucch2_polar_4bit[cw&15])[3],((int16_t*)&pucch2_polar_4bit[cw>>4])[3],
((int16_t*)&rp_re[aa][half_prb])[0],((int16_t*)&rp_im[aa][half_prb])[0],
((int16_t*)&rp_re[aa][half_prb])[1],((int16_t*)&rp_im[aa][half_prb])[1],
((int16_t*)&rp_re[aa][half_prb])[2],((int16_t*)&rp_im[aa][half_prb])[2],
((int16_t*)&rp_re[aa][half_prb])[3],((int16_t*)&rp_im[aa][half_prb])[3],
corr32_re[half_prb>>2][aa]/(2*nc_group_size*4/2),corr32_im[half_prb>>2][aa]/(2*nc_group_size*4/2),
((int16_t*)(&prod_re[aa]))[0],
((int16_t*)(&prod_im[aa]))[0],
corr_re,
corr_im,
corr_tmp);
*/
/*
LOG_D(PHY,"pucch2 half_prb %d cw %d (%d,%d) aa %d: (%d,%d,%d,%d,%d,%d,%d,%d)x(%d,%d,%d,%d,%d,%d,%d,%d) (%d,%d)+(%d,%d) = (%d,%d) => %d\n",
half_prb,cw,cw&15,cw>>4,aa,
((int16_t*)&pucch2_polar_4bit[cw&15])[0],((int16_t*)&pucch2_polar_4bit[cw>>4])[0],
((int16_t*)&pucch2_polar_4bit[cw&15])[1],((int16_t*)&pucch2_polar_4bit[cw>>4])[1],
((int16_t*)&pucch2_polar_4bit[cw&15])[2],((int16_t*)&pucch2_polar_4bit[cw>>4])[2],
((int16_t*)&pucch2_polar_4bit[cw&15])[3],((int16_t*)&pucch2_polar_4bit[cw>>4])[3],
((int16_t*)&rp_re[aa][half_prb])[0],((int16_t*)&rp_im[aa][half_prb])[0],
((int16_t*)&rp_re[aa][half_prb])[1],((int16_t*)&rp_im[aa][half_prb])[1],
((int16_t*)&rp_re[aa][half_prb])[2],((int16_t*)&rp_im[aa][half_prb])[2],
((int16_t*)&rp_re[aa][half_prb])[3],((int16_t*)&rp_im[aa][half_prb])[3],
corr32_re[half_prb>>2][aa]/(2*nc_group_size*4/2),corr32_im[half_prb>>2][aa]/(2*nc_group_size*4/2),
((int16_t*)(&prod_re[aa]))[0],
((int16_t*)(&prod_im[aa]))[0],
corr_re,
corr_im,
corr_tmp);
*/
}
corr16 = _mm_set1_epi16((int16_t)(corr_tmp>>8));
/*
@@ -1625,26 +1594,34 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
} // half_prb
// run polar decoder on llrs
decoderState = polar_decoder_int16((int16_t*)llrs, decodedPayload, 0, currentPtr);
LOG_D(PHY,"UCI decoderState %d, payload[0] %llux\n",decoderState,(unsigned long long)decodedPayload[0]);
LOG_D(PHY,"UCI decoderState %d, payload[0] %llu\n",decoderState,(unsigned long long)decodedPayload[0]);
if (decoderState>0) decoderState=1;
corr_dB = dB_fixed64(corr);
LOG_D(PHY,"metric %d dB\n",corr_dB);
}
re_offset = (12*pucch_pdu->prb_start) + (12*pucch_pdu->bwp_start) + frame_parms->first_carrier_offset;
// estimate CQI for MAC (from antenna port 0 only)
int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset],12*pucch_pdu->prb_size)) - (10*gNB->measurements.n0_power_tot_dB);
int cqi;
if (SNRtimes10 < -640) cqi=0;
else if (SNRtimes10 > 635) cqi=255;
else cqi=(640+SNRtimes10)/5;
uci_pdu->harq.harq_bit_len = pucch_pdu->bit_len_harq;
uci_pdu->pduBitmap=0;
uci_pdu->rnti=pucch_pdu->rnti;
uci_pdu->handle=pucch_pdu->handle;
uci_pdu->pucch_format=0;
uci_pdu->ul_cqi=corr_dB;
// need to fill these field!
uci_pdu->timing_advance=31;
uci_pdu->rssi=0;
uci_pdu->ul_cqi=cqi;
uci_pdu->timing_advance=0xffff; // currently not valid
uci_pdu->rssi=1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy_nodc(&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset],12*pucch_pdu->prb_size)));
if (pucch_pdu->bit_len_harq>0) {
int harq_bytes=pucch_pdu->bit_len_harq>>3;
if ((pucch_pdu->bit_len_harq&7) > 0) harq_bytes++;
uci_pdu->pduBitmap|=1;
uci_pdu->harq.harq_payload = (uint8_t*)malloc(harq_bytes);
uci_pdu->harq.harq_crc = decoderState > 0 ? 1 : 0;
uci_pdu->harq.harq_crc = decoderState;
int i=0;
for (;i<harq_bytes-1;i++) {
uci_pdu->harq.harq_payload[i] = decodedPayload[0] & 255;
@@ -1667,19 +1644,18 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
int csi_part1_bytes=pucch_pdu->bit_len_csi_part1>>3;
if ((pucch_pdu->bit_len_csi_part1&7) > 0) csi_part1_bytes++;
uci_pdu->csi_part1.csi_part1_payload = (uint8_t*)malloc(csi_part1_bytes);
uci_pdu->csi_part1.csi_part1_crc = decoderState > 0 ? 1 : 0;
uci_pdu->csi_part1.csi_part1_crc = decoderState;
int i=0;
for (;i<csi_part1_bytes-1;i++) {
uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & 255;
decodedPayload[0]>>=8;
}
uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & ((1<<(pucch_pdu->bit_len_csi_part1&7))-1);
decodedPayload[0] >>= pucch_pdu->bit_len_csi_part1;
decodedPayload[0] >>= pucch_pdu->bit_len_csi_part1;
}
if (pucch_pdu->bit_len_csi_part2>0) {
uci_pdu->pduBitmap|=8;
}
}
@@ -87,6 +87,10 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
unsigned char rank_adaptation,
uint8_t subframe);
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
uint8_t slot,
uint8_t abstraction_flag);
void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue,
uint32_t rx_power_fil_dB,
uint8_t eNB_id);
@@ -94,4 +98,6 @@ void phy_adjust_gain_nr(PHY_VARS_NR_UE *ue,
int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index);
float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index);
#endif
@@ -23,6 +23,7 @@
#include "PHY/phy_extern_nr_ue.h"
#include "common/utils/LOG/log.h"
#include "PHY/sse_intrin.h"
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
//#define k1 1000
#define k1 ((long long int) 1000)
@@ -76,6 +77,35 @@ int16_t get_nr_PL(uint8_t Mod_id, uint8_t CC_id, uint8_t gNB_index){
//(ue->frame_parms.pdsch_config_common.referenceSignalPower*10))/10));
}
uint32_t get_nr_rx_total_gain_dB (module_id_t Mod_id,uint8_t CC_id)
{
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
if (ue)
return ue->rx_total_gain_dB;
return 0xFFFFFFFF;
}
float_t get_nr_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t gNB_index)
{
AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is null\n");
AssertFatal(PHY_vars_UE_g[Mod_id]!=NULL,"PHY_vars_UE_g[%d] is null\n",Mod_id);
AssertFatal(PHY_vars_UE_g[Mod_id][CC_id]!=NULL,"PHY_vars_UE_g[%d][%d] is null\n",Mod_id,CC_id);
PHY_VARS_NR_UE *ue = PHY_vars_UE_g[Mod_id][CC_id];
if (ue)
return (10*log10(ue->measurements.rsrp[gNB_index])-
get_nr_rx_total_gain_dB(Mod_id,0) -
10*log10(20*12));
return -140.0;
}
void nr_ue_measurements(PHY_VARS_NR_UE *ue,
unsigned int subframe_offset,
unsigned char N0_symbol,
@@ -191,4 +221,74 @@ void nr_ue_measurements(PHY_VARS_NR_UE *ue,
_mm_empty();
_m_empty();
#endif
}
}
void nr_ue_rsrp_measurements(PHY_VARS_NR_UE *ue,
uint8_t slot,
uint8_t abstraction_flag)
{
int aarx,rb, symbol_offset;
int16_t *rxF;
uint16_t Nid_cell = ue->frame_parms.Nid_cell;
uint8_t eNB_offset=0,l,nushift;
uint16_t off,nb_rb;
// NR_UE_MAC_INST_t *mac = get_mac_inst(0);
int **rxdataF=ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[slot]].rxdataF;
nushift = ue->frame_parms.Nid_cell%4;
ue->frame_parms.nushift = nushift;
unsigned int ssb_offset = ue->frame_parms.first_carrier_offset + ue->frame_parms.ssb_start_subcarrier;
if (ssb_offset>= ue->frame_parms.ofdm_symbol_size) ssb_offset-=ue->frame_parms.ofdm_symbol_size;
symbol_offset = ue->frame_parms.ofdm_symbol_size*(ue->symbol_offset+1);
ue->measurements.rsrp[eNB_offset] = 0;
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
nb_rb = 20;
//} else{
// LOG_E(PHY,"report quantity not supported \n");
//}
if (abstraction_flag == 0) {
for (l=0; l<1; l++) {
LOG_D(PHY,"[UE %d] slot %d Doing ue_rrc_measurements rsrp/rssi (Nid_cell %d, nushift %d, eNB_offset %d, l %d)\n",ue->Mod_id,slot,Nid_cell,nushift,
eNB_offset,l);
for (aarx=0; aarx<ue->frame_parms.nb_antennas_rx; aarx++) {
rxF = (int16_t *)&rxdataF[aarx][(symbol_offset+ssb_offset+nushift)];
off = 0;
if (l==0) {
for (rb=0; rb<nb_rb; rb++) {
ue->measurements.rsrp[eNB_offset] += (((int32_t)(rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1]));
//printf("rb %d, off %d : %d\n",rb,off,((((int32_t)rxF[off])*rxF[off])+((int32_t)(rxF[off+1])*rxF[off+1])));
off = (off+4) % ue->frame_parms.ofdm_symbol_size;
}
}
}
}
ue->measurements.rsrp[eNB_offset]/=nb_rb;
} else {
ue->measurements.rsrp[eNB_offset] = -93 ;
}
if (eNB_offset == 0)
LOG_I(PHY,"[UE %d] slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f dBm/RE (%d)\n",
ue->Mod_id,
slot,eNB_offset,
(eNB_offset>0) ? ue->measurements.adj_cell_id[eNB_offset-1] : ue->frame_parms.Nid_cell,
10*log10(ue->measurements.rsrp[eNB_offset])-ue->rx_total_gain_dB,
ue->measurements.rsrp[eNB_offset]);
}
+35 -33
View File
@@ -48,8 +48,7 @@ extern uint16_t prach_root_sequence_map_0_3[838];
extern uint16_t prach_root_sequence_map_abc[138];
extern uint16_t nr_du[838];
extern int16_t nr_ru[2*839];
extern const char *prachfmt[9];
extern const char *prachfmt03[4];
extern const char *prachfmt[];
// Note:
// - prach_fmt_id is an ID used to map to the corresponding PRACH format value in prachfmt
@@ -72,7 +71,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
int16_t Ncp = 0, amp, *prach, *prach2, *prachF, *Xu;
int32_t Xu_re, Xu_im;
int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, n_ra_prb, k;
int prach_start, prach_sequence_length, i, prach_len, dftlen, mu, kbar, K, n_ra_prb, k, prachStartSymbol, sample_offset_slot;
//int restricted_Type;
prach = prach_tmp;
@@ -95,7 +94,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
kbar = 1;
K = 24;
k = 12*n_ra_prb - 6*fp->N_RB_UL;
//prachStartSymbol = prach_config_pdu->prach_start_symbol
prachStartSymbol = prach_pdu->prach_start_symbol;
//restricted_Type = 0;
compute_nr_prach_seq(nrUE_config->prach_config.prach_sequence_length,
@@ -103,7 +102,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].prach_root_sequence_index,
ue->X_u);
prach_start = fp->get_samples_slot_timestamp(slot, fp, 0);
sample_offset_slot = (prachStartSymbol==0?0:fp->ofdm_symbol_size*prachStartSymbol+fp->nb_prefix_samples0+fp->nb_prefix_samples*(prachStartSymbol-1));
prach_start = fp->get_samples_slot_timestamp(slot, fp, 0) + sample_offset_slot;
// First compute physical root sequence
/************************************************************************
@@ -181,14 +181,14 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
}
// now generate PRACH signal
#ifdef NR_PRACH_DEBUG
#ifdef NR_PRACH_DEBUG
if (NCS>0)
LOG_I(PHY, "PRACH [UE %d] generate PRACH in slot %d for RootSeqIndex %d, Preamble Index %d, PRACH Format %s, NCS %d (N_ZC %d): Preamble_offset %d, Preamble_shift %d msg1 frequency start %d\n",
Mod_id,
slot,
rootSequenceIndex,
preamble_index,
prach_sequence_length == 0 ? prachfmt03[prach_fmt_id] : prachfmt[prach_fmt_id],
prachfmt[prach_fmt_id],
NCS,
N_ZC,
preamble_offset,
@@ -362,31 +362,33 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
} else {
switch (prach_fmt_id) {
case 0: //A1
case 4: //A1
Ncp = 288/(1<<mu);
break;
case 1: //A2
case 5: //A2
Ncp = 576/(1<<mu);
break;
case 2: //A3
case 6: //A3
Ncp = 864/(1<<mu);
break;
case 3: //B1
case 7: //B1
Ncp = 216/(1<<mu);
break;
/*
case 4: //B2
Ncp = 360/(1<<mu);
break;
case 5: //B3
Ncp = 504/(1<<mu);
break;
case 6: //B4
*/
case 8: //B4
Ncp = 936/(1<<mu);
break;
case 7: //C0
case 9: //C0
Ncp = 1240/(1<<mu);
break;
case 8: //C2
case 10: //C2
Ncp = 2048/(1<<mu);
break;
default:
@@ -440,19 +442,19 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
prach_len = (12288*4)+Ncp;
}
} else { // short PRACH sequence
if (prach_fmt_id == 0 || prach_fmt_id == 3 || prach_fmt_id == 7) {
if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) {
Ncp+=32; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_2048,prachF,prach2,1);
// here we have |empty | Prach2048 |
if (prach_fmt_id != 7) {
if (prach_fmt_id != 9) {
memmove(prach2+(2048<<1),prach2,(2048<<2));
prach_len = (2048*2)+Ncp;
}
else prach_len = (2048*1)+Ncp;
memmove(prach,prach+(2048<<1),(Ncp<<2));
// here we have |Prefix | Prach2048 | Prach2048 (if ! 0xc0) |
} else if (prach_fmt_id == 1 || prach_fmt_id == 4) { // 6x2048
} else if (prach_fmt_id == 5) { // 6x2048
Ncp+=32; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_2048,prachF,prach2,1);
@@ -464,7 +466,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
memmove(prach,prach+(2048<<1),(Ncp<<2));
// here we have |Prefix | Prach2048 |
prach_len = (2048*4)+Ncp;
} else if (prach_fmt_id == 2 || prach_fmt_id == 5) { // 6x2048
} else if (prach_fmt_id == 6) { // 6x2048
Ncp+=32;
prach2 = prach+(Ncp<<1);
idft(IDFT_2048,prachF,prach2,1);
@@ -478,7 +480,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
memmove(prach,prach+(2048<<1),(Ncp<<2));
// here we have |Prefix | Prach2048 |
prach_len = (2048*6)+Ncp;
} else if (prach_fmt_id == 6) { // 12x2048
} else if (prach_fmt_id == 8) { // 12x2048
Ncp+=32; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_2048,prachF,prach2,1);
@@ -533,12 +535,12 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
prach_len = (9216*4)+Ncp;
}
} else { // short sequence
if (prach_fmt_id == 0 || prach_fmt_id == 3 || prach_fmt_id == 7) {
if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) {
Ncp+=24; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_1536,prachF,prach2,1);
// here we have |empty | Prach1536 |
if (prach_fmt_id != 7) {
if (prach_fmt_id != 9) {
memmove(prach2+(1536<<1),prach2,(1536<<2));
prach_len = (1536*2)+Ncp;
} else prach_len = (1536*1)+Ncp;
@@ -546,7 +548,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
memmove(prach,prach+(1536<<1),(Ncp<<2));
// here we have |Prefix | Prach1536 | Prach1536 (if ! 0xc0) |
} else if (prach_fmt_id == 1 || prach_fmt_id == 4) { // 6x1536
} else if (prach_fmt_id == 5) { // 6x1536
Ncp+=24; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
@@ -559,7 +561,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
memmove(prach,prach+(1536<<1),(Ncp<<2));
// here we have |Prefix | Prach1536 |
prach_len = (1536*4)+Ncp;
} else if (prach_fmt_id == 2 || prach_fmt_id == 5) { // 6x1536
} else if (prach_fmt_id == 6) { // 6x1536
Ncp+=24; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_1536,prachF,prach2,1);
@@ -573,7 +575,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
memmove(prach,prach+(1536<<1),(Ncp<<2));
// here we have |Prefix | Prach1536 |
prach_len = (1536*6)+Ncp;
} else if (prach_fmt_id == 6) { // 12x1536
} else if (prach_fmt_id == 8) { // 12x1536
Ncp+=24; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_1536,prachF,prach2,1);
@@ -630,18 +632,18 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
prach_len = (24576*4)+Ncp;
}
} else { // short sequence
if (prach_fmt_id == 0 || prach_fmt_id == 3 || prach_fmt_id == 7) {
if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) {
Ncp+=64; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_4096,prachF,prach2,1);
// here we have |empty | Prach4096 |
if (prach_fmt_id != 7) {
if (prach_fmt_id != 9) {
memmove(prach2+(4096<<1),prach2,(4096<<2));
prach_len = (4096*2)+Ncp;
} else prach_len = (4096*1)+Ncp;
memmove(prach,prach+(4096<<1),(Ncp<<2));
// here we have |Prefix | Prach4096 | Prach4096 (if ! 0xc0) |
} else if (prach_fmt_id == 1 || prach_fmt_id == 4) { // 4x4096
} else if (prach_fmt_id == 5) { // 4x4096
Ncp+=64; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_4096,prachF,prach2,1);
@@ -653,7 +655,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
memmove(prach,prach+(4096<<1),(Ncp<<2));
// here we have |Prefix | Prach4096 |
prach_len = (4096*4)+Ncp;
} else if (prach_fmt_id == 2 || prach_fmt_id == 5) { // 6x4096
} else if (prach_fmt_id == 6) { // 6x4096
Ncp+=64; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_4096,prachF,prach2,1);
@@ -667,7 +669,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
memmove(prach,prach+(4096<<1),(Ncp<<2));
// here we have |Prefix | Prach4096 |
prach_len = (4096*6)+Ncp;
} else if (prach_fmt_id == 6) { // 12x4096
} else if (prach_fmt_id == 8) { // 12x4096
Ncp+=64; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_4096,prachF,prach2,1);
@@ -722,18 +724,18 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
prach_len = (18432*4)+Ncp;
}
} else { // short sequence
if (prach_fmt_id == 0 || prach_fmt_id == 3 || prach_fmt_id == 7) {
if (prach_fmt_id == 4 || prach_fmt_id == 7 || prach_fmt_id == 9) {
Ncp+=48; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_3072,prachF,prach2,1);
// here we have |empty | Prach3072 |
if (prach_fmt_id != 7) {
if (prach_fmt_id != 9) {
memmove(prach2+(3072<<1),prach2,(3072<<2));
prach_len = (3072*2)+Ncp;
} else prach_len = (3072*1)+Ncp;
memmove(prach,prach+(3072<<1),(Ncp<<2));
// here we have |Prefix | Prach3072 | Prach3072 (if ! 0xc0) |
} else if (prach_fmt_id == 2 || prach_fmt_id == 5) { // 6x3072
} else if (prach_fmt_id == 6) { // 6x3072
Ncp+=48; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_3072,prachF,prach2,1);
@@ -747,7 +749,7 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){
memmove(prach,prach+(3072<<1),(Ncp<<2));
// here we have |Prefix | Prach3072 |
prach_len = (3072*6)+Ncp;
} else if (prach_fmt_id == 1 || prach_fmt_id == 4) { // 4x3072
} else if (prach_fmt_id == 5) { // 4x3072
Ncp+=48; // This assumes we are transmitting starting in symbol 0 of a PRACH slot, 30 kHz, full sampling
prach2 = prach+(Ncp<<1);
idft(IDFT_3072,prachF,prach2,1);
+5 -1
View File
@@ -1045,7 +1045,11 @@ void nr_generate_pucch2(PHY_VARS_NR_UE *ue,
for (int l=0; l<nrofSymbols; l++) {
x2 = (((1<<17)*((14*nr_tti_tx) + (l+startingSymbolIndex) + 1)*((2*dmrs_scrambling_id) + 1)) + (2*dmrs_scrambling_id))%(1U<<31); // c_init calculation according to TS38.211 subclause
s = lte_gold_generic(&x1, &x2, 1);
int reset = 1;
for (int ii=0; ii<=(startingPRB>>2); ii++) {
s = lte_gold_generic(&x1, &x2, reset);
reset = 0;
}
m = 0;
for (int rb=0; rb<nrofPRB; rb++) {
//startingPRB = startingPRB + rb;
+4 -2
View File
@@ -191,9 +191,11 @@ typedef struct {
int fmt;
int numRA;
int prachStartSymbol;
int num_prach_ocas;
} RU_PRACH_list_t;
#define NUMBER_OF_NR_RU_PRACH_MAX 8
#define NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX 12
typedef struct RU_proc_t_s {
/// Pointer to associated RU descriptor
@@ -594,8 +596,8 @@ typedef struct RU_t_s {
RU_PRACH_list_t prach_list[NUMBER_OF_NR_RU_PRACH_MAX];
/// mutex for prach_list access
pthread_mutex_t prach_list_mutex;
/// received frequency-domain signal for PRACH (IF4p5 RRU)
int16_t **prach_rxsigF;
/// received frequency-domain signal for PRACH (IF4p5 RRU)
int16_t **prach_rxsigF[NUMBER_OF_NR_RU_PRACH_OCCASIONS_MAX];
/// received frequency-domain signal for PRACH BR (IF4p5 RRU)
int16_t **prach_rxsigF_br[4];
/// sequence number for IF5
+3
View File
@@ -752,6 +752,9 @@ typedef struct PHY_VARS_gNB_s {
uint32_t rb_mask_ul[9];
int ulmask_symb;
/// CSI RS sequence
uint32_t ***nr_gold_csi_rs;
/// Indicator set to 0 after first SR
uint8_t first_sr[NUMBER_OF_NR_SR_MAX];
+3
View File
@@ -82,6 +82,9 @@
#define NR_MAX_PDSCH_DMRS_LENGTH 3300 //275*6(k)*2(QPSK real+imag)
#define NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD 104 // ceil(NR_MAX_PDSCH_DMRS_LENGTH/32)
#define NR_MAX_CSI_RS_LENGTH 4400 //275*8(max allocation per RB)*2(QPSK)
#define NR_MAX_CSI_RS_INIT_LENGTH_DWORD 138 // ceil(NR_MAX_CSI_RS_LENGTH/32)
#define NR_MAX_PUSCH_DMRS_LENGTH NR_MAX_PDSCH_DMRS_LENGTH
#define NR_MAX_PUSCH_DMRS_INIT_LENGTH_DWORD NR_MAX_PDSCH_DMRS_INIT_LENGTH_DWORD
+1 -1
View File
@@ -80,7 +80,7 @@ void prach_procedures(PHY_VARS_eNB *eNB,
ru=eNB->RU_list[i];
for (ru_aa=0,aa=0; ru_aa<ru->nb_rx; ru_aa++,aa++) {
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[ru_aa];
eNB->prach_vars.rxsigF[0][aa] = eNB->RU_list[i]->prach_rxsigF[0][ru_aa];
int ce_level;
if (br_flag==1)
+92 -65
View File
@@ -52,87 +52,114 @@ extern uint8_t nfapi_mode;
extern int oai_nfapi_nr_rach_ind(nfapi_rach_indication_t *rach_ind);
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot,
nfapi_nr_prach_pdu_t *prach_pdu) {
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot) {
uint16_t max_preamble[4]={0},max_preamble_energy[4]={0},max_preamble_delay[4]={0};
uint16_t i;
gNB->UL_INFO.rach_ind.number_of_pdus=0;
uint8_t pdu_index = 0;
RU_t *ru;
int aa=0;
int ru_aa;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,1);
gNB->UL_INFO.rach_ind.sfn = frame;
gNB->UL_INFO.rach_ind.slot = slot;
gNB->UL_INFO.rach_ind.pdu_list = gNB->prach_pdu_indication_list;
gNB->UL_INFO.rach_ind.number_of_pdus = 0;
ru=gNB->RU_list[0];
int prach_id=find_nr_prach(gNB,frame,slot,SEARCH_EXIST);
if (prach_id>=0) {
nfapi_nr_prach_pdu_t *prach_pdu = &gNB->prach_vars.list[prach_id].pdu;
uint8_t prachStartSymbol;
uint8_t N_dur = get_nr_prach_duration(prach_pdu->prach_format);
/*
uint16_t format,RA_sfn_index;
uint8_t start_symbol,N_t_slot,N_dur,N_RA_slot,config_period;
for (i=0;i<gNB->num_RU;i++) {
ru=gNB->RU_list[i];
for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) {
gNB->prach_vars.rxsigF[aa] = gNB->RU_list[i]->prach_rxsigF[ru_aa];
}
}
get_nr_prach_info_from_index(gNB->gNB_config.prach_config.prach_ConfigurationIndex.value,
frame,slot,
gNB->gNB_config.carrier_config.dl_frequency.value,
gNB->frame_parms.numerology_index,
gNB->frame_parms.frame_type,
&format,
&start_symbol,
&N_t_slot,
&N_dur,
&RA_sfn_index,
&N_RA_slot,
&config_period);
*/
for(int prach_oc = 0; prach_oc < prach_pdu->num_prach_ocas; prach_oc++) {
for (ru_aa=0,aa=0;ru_aa<ru->nb_rx;ru_aa++,aa++) {
gNB->prach_vars.rxsigF[aa] = ru->prach_rxsigF[prach_oc][ru_aa];
}
rx_nr_prach(gNB,
prach_pdu,
prachStartSymbol = prach_pdu->prach_start_symbol+prach_oc*N_dur;
//comment FK: the standard 38.211 section 5.3.2 has one extra term +14*N_RA_slot. This is because there prachStartSymbol is given wrt to start of the 15kHz slot or 60kHz slot. Here we work slot based, so this function is anyway only called in slots where there is PRACH. Its up to the MAC to schedule another PRACH PDU in the case there are there N_RA_slot \in {0,1}.
rx_nr_prach(gNB,
prach_pdu,
prach_oc,
frame,
slot,
&max_preamble[0],
&max_preamble_energy[0],
&max_preamble_delay[0]
);
free_nr_prach_entry(gNB,prach_id);
LOG_D(PHY,"[RAPROC] Frame %d, slot %d, occasion %d (prachStartSymbol %d) : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
frame,slot,prach_oc,prachStartSymbol,
max_preamble[0],
max_preamble_energy[0]/10,
max_preamble_delay[0],
gNB->prach_energy_counter);
if ((gNB->prach_energy_counter == 100) &&
(max_preamble_energy[0] > gNB->measurements.prach_I0+100)) {
LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d start symbol %u freq index %u\n",
gNB->Mod_id,
frame,
slot,
&max_preamble[0],
&max_preamble_energy[0],
&max_preamble_delay[0]
);
LOG_D(PHY,"[RAPROC] Frame %d, slot %d : Most likely preamble %d, energy %d dB delay %d (prach_energy counter %d)\n",
frame,slot,
max_preamble[0],
max_preamble_energy[0]/10,
max_preamble_delay[0],
gNB->prach_energy_counter);
if ((gNB->prach_energy_counter == 100) &&
(max_preamble_energy[0] > gNB->measurements.prach_I0+100)) {
LOG_I(PHY,"[gNB %d][RAPROC] Frame %d, slot %d Initiating RA procedure with preamble %d, energy %d.%d dB, delay %d\n",
gNB->Mod_id,
frame,
slot,
max_preamble[0],
max_preamble_energy[0]/10,
max_preamble_energy[0]%10,
max_preamble_delay[0]);
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(gNB->Mod_id), T_INT(frame), T_INT(slot),
T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
gNB->UL_INFO.rach_ind.number_of_pdus = 1;
gNB->UL_INFO.rach_ind.pdu_list = &gNB->prach_pdu_indication_list[0];
gNB->UL_INFO.rach_ind.sfn = frame;
gNB->UL_INFO.rach_ind.slot = slot;
gNB->prach_pdu_indication_list[0].phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value;
gNB->prach_pdu_indication_list[0].symbol_index = prach_pdu->prach_start_symbol; // FIXME to be changed for multi-ssb (this is only the start symbol of first occasion)
gNB->prach_pdu_indication_list[0].slot_index = slot;
gNB->prach_pdu_indication_list[0].freq_index = prach_pdu->num_ra;
gNB->prach_pdu_indication_list[0].avg_rssi = (max_preamble_energy[0]<631) ? (128+(max_preamble_energy[0]/5)) : 254;
gNB->prach_pdu_indication_list[0].avg_snr = 0xff; // invalid for now
gNB->prach_pdu_indication_list[0].num_preamble = 1;
gNB->prach_pdu_indication_list[0].preamble_list = gNB->preamble_list;
gNB->prach_pdu_indication_list[0].preamble_list[0].preamble_index = max_preamble[0];
gNB->prach_pdu_indication_list[0].preamble_list[0].timing_advance = max_preamble_delay[0];
gNB->prach_pdu_indication_list[0].preamble_list[0].preamble_pwr = 0xffffffff;
}
gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10);
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
if (gNB->prach_energy_counter < 100) gNB->prach_energy_counter++;
max_preamble[0],
max_preamble_energy[0]/10,
max_preamble_energy[0]%10,
max_preamble_delay[0],
prachStartSymbol,
prach_pdu->num_ra);
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(gNB->Mod_id), T_INT(frame), T_INT(slot),
T_INT(max_preamble[0]), T_INT(max_preamble_energy[0]), T_INT(max_preamble_delay[0]));
gNB->UL_INFO.rach_ind.number_of_pdus += 1;
gNB->prach_pdu_indication_list[pdu_index].phy_cell_id = gNB->gNB_config.cell_config.phy_cell_id.value;
gNB->prach_pdu_indication_list[pdu_index].symbol_index = prachStartSymbol;
gNB->prach_pdu_indication_list[pdu_index].slot_index = slot;
gNB->prach_pdu_indication_list[pdu_index].freq_index = prach_pdu->num_ra;
gNB->prach_pdu_indication_list[pdu_index].avg_rssi = (max_preamble_energy[0]<631) ? (128+(max_preamble_energy[0]/5)) : 254;
gNB->prach_pdu_indication_list[pdu_index].avg_snr = 0xff; // invalid for now
gNB->prach_pdu_indication_list[pdu_index].num_preamble = 1;
gNB->prach_pdu_indication_list[pdu_index].preamble_list = gNB->preamble_list;
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].preamble_index = max_preamble[0];
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].timing_advance = max_preamble_delay[0];
gNB->prach_pdu_indication_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff;
pdu_index++;
}
gNB->measurements.prach_I0 = ((gNB->measurements.prach_I0*900)>>10) + ((max_preamble_energy[0]*124)>>10);
if (frame==0) LOG_I(PHY,"prach_I0 = %d.%d dB\n",gNB->measurements.prach_I0/10,gNB->measurements.prach_I0%10);
if (gNB->prach_energy_counter < 100) gNB->prach_energy_counter++;
} //if prach_id>0
} //for NUMBER_OF_NR_PRACH_OCCASION_MAX
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PRACH_RX,0);
}
+28 -8
View File
@@ -113,7 +113,15 @@ void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot) {
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[n_hf][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
else
nr_generate_pbch_dmrs(gNB->nr_gold_pbch_dmrs[0][ssb_index&7],&txdataF[0][txdataF_offset], AMP, ssb_start_symbol, cfg, fp);
if (T_ACTIVE(T_GNB_PHY_MIB)) {
unsigned char bch[3];
bch[0] = gNB->ssb_pdu.ssb_pdu_rel15.bchPayload & 0xff;
bch[1] = (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload >> 8) & 0xff;
bch[2] = (gNB->ssb_pdu.ssb_pdu_rel15.bchPayload >> 16) & 0xff;
T(T_GNB_PHY_MIB, T_INT(0) /* module ID */, T_INT(frame), T_INT(slot), T_BUFFER(bch, 3));
}
nr_generate_pbch(&gNB->pbch,
&gNB->ssb_pdu,
gNB->nr_pbch_interleaver,
@@ -136,8 +144,6 @@ void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB,
int offset = gNB->CC_id;
uint8_t ssb_frame_periodicity = 1; // every how many frames SSB are generated
int txdataF_offset = (slot%2)*fp->samples_per_slot_wCP;
if (cfg->ssb_table.ssb_period.value > 1)
ssb_frame_periodicity = 1 <<(cfg->ssb_table.ssb_period.value -1) ;
@@ -519,7 +525,6 @@ void phy_procedures_gNB_common_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
0);
}
}
}
void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) {
@@ -537,12 +542,10 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
(pucch->frame == frame_rx) &&
(pucch->slot == slot_rx) ) {
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch[i].pucch_pdu;
nfapi_nr_pucch_pdu_t *pucch_pdu = &pucch->pucch_pdu;
uint16_t num_ucis;
switch (pucch_pdu->format_type) {
case 0:
num_ucis = gNB->UL_INFO.uci_ind.num_ucis;
gNB->UL_INFO.uci_ind.uci_list = &gNB->uci_pdu_list[0];
gNB->UL_INFO.uci_ind.sfn = frame_rx;
@@ -559,8 +562,25 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx)
gNB->UL_INFO.uci_ind.num_ucis += 1;
pucch->active = 0;
break;
case 2:
num_ucis = gNB->UL_INFO.uci_ind.num_ucis;
gNB->UL_INFO.uci_ind.uci_list = &gNB->uci_pdu_list[0];
gNB->UL_INFO.uci_ind.sfn = frame_rx;
gNB->UL_INFO.uci_ind.slot = slot_rx;
gNB->uci_pdu_list[num_ucis].pdu_type = NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE;
gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t);
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4;
nr_decode_pucch2(gNB,
slot_rx,
uci_pdu_format2,
pucch_pdu);
gNB->UL_INFO.uci_ind.num_ucis += 1;
pucch->active = 0;
break;
default:
AssertFatal(1==0,"Only PUCCH format 0 is currently supported\n");
AssertFatal(1==0,"Only PUCCH formats 0 and 2 are currently supported\n");
}
}
}
+1 -1
View File
@@ -39,7 +39,7 @@ void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_scf_t *cfg, NR_DL_FRAME
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, int frame_tx, int slot_tx, int do_meas);
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 L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot,nfapi_nr_prach_pdu_t *prach_pdu);
void L1_nr_prach_procedures(PHY_VARS_gNB *gNB,int frame,int slot);
void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot);
void nr_feptx_ofdm(RU_t *ru,int frame_tx,int tti_tx);
void nr_feptx_ofdm_2thread(RU_t *ru,int frame_tx,int tti_tx);
+66 -107
View File
@@ -50,7 +50,9 @@
#include "SCHED/phy_procedures_emos.h"
#endif
#include "executables/softmodem-common.h"
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
//#define DEBUG_PHY_PROC
#define NR_PDCCH_SCHED
//#define NR_PDCCH_SCHED_DEBUG
//#define NR_PUCCH_SCHED
@@ -216,7 +218,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
/* RACH */
if (get_softmodem_params()->do_ra==1) {
if ((ue->UE_mode[gNB_id] < PUSCH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) {
if ((ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) {
nr_ue_prach_procedures(ue, proc, gNB_id, mode);
}
}
@@ -904,6 +906,9 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
int *dlsch_errors,
runmode_t mode) {
if (dlsch0==NULL)
AssertFatal(0,"dlsch0 should be defined at this level \n");
int harq_pid = dlsch0->current_harq_pid;
int frame_rx = proc->frame_rx;
int nr_tti_rx = proc->nr_tti_rx;
@@ -931,9 +936,6 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
uint16_t bw_scaling, start_symbol;
float tc_factor;
if (dlsch0==NULL)
AssertFatal(0,"dlsch0 should be defined at this level \n");
is_cw0_active = dlsch0->harq_processes[harq_pid]->status;
nb_symb_sch = dlsch0->harq_processes[harq_pid]->nb_symbols;
start_symbol = dlsch0->harq_processes[harq_pid]->start_symbol;
@@ -1362,9 +1364,9 @@ void *UE_thread_slot1_dl_processing(void *arg) {
CPU_ZERO(&cpuset);
if ( (proc->sub_frame_start+1)%RX_NB_TH == 0 && threads.slot1_proc_one != -1 )
CPU_SET(threads.slot1_proc_one, &cpuset);
if ( (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 )
if ( RX_NB_TH > 1 && (proc->sub_frame_start+1)%RX_NB_TH == 1 && threads.slot1_proc_two != -1 )
CPU_SET(threads.slot1_proc_two, &cpuset);
if ( (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 )
if ( RX_NB_TH > 2 && (proc->sub_frame_start+1)%RX_NB_TH == 2 && threads.slot1_proc_three != -1 )
CPU_SET(threads.slot1_proc_three, &cpuset);
init_thread(900000,1000000 , FIFO_PRIORITY-1, &cpuset,
@@ -1713,6 +1715,8 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
uint8_t dci_cnt = 0;
NR_DL_FRAME_PARMS *fp = &ue->frame_parms;
//NR_UE_MAC_INST_t *mac = get_mac_inst(0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
LOG_D(PHY," ****** start RX-Chain for Frame.Slot %d.%d ****** \n", frame_rx%1024, nr_tti_rx);
@@ -1752,6 +1756,12 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
#endif
}
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
nr_ue_rsrp_measurements(ue,nr_tti_rx,0);
//}
nr_ue_pbch_procedures(gNB_id, ue, proc, 0);
if (ue->no_timing_correction==0) {
@@ -1878,24 +1888,48 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if ((ue->dlsch_SI[gNB_id]) && (ue->dlsch_SI[gNB_id]->active == 1)) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_IN);
nr_ue_pdsch_procedures(ue,
proc,
gNB_id,
SI_PDSCH,
ue->dlsch_SI[gNB_id],
NULL);
proc,
gNB_id,
SI_PDSCH,
ue->dlsch_SI[gNB_id],
NULL);
nr_ue_dlsch_procedures(ue,
proc,
gNB_id,
SI_PDSCH,
ue->dlsch_SI[gNB_id],
NULL,
&ue->dlsch_SI_errors[gNB_id],
mode);
// deactivate dlsch once dlsch proc is done
ue->dlsch_SI[gNB_id]->active = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_SI, VCD_FUNCTION_OUT);
}
// do procedures for SI-RNTI
// do procedures for P-RNTI
if ((ue->dlsch_p[gNB_id]) && (ue->dlsch_p[gNB_id]->active == 1)) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_IN);
nr_ue_pdsch_procedures(ue,
proc,
gNB_id,
P_PDSCH,
ue->dlsch_p[gNB_id],
NULL);
proc,
gNB_id,
P_PDSCH,
ue->dlsch_p[gNB_id],
NULL);
nr_ue_dlsch_procedures(ue,
proc,
gNB_id,
P_PDSCH,
ue->dlsch_p[gNB_id],
NULL,
&ue->dlsch_p_errors[gNB_id],
mode);
// deactivate dlsch once dlsch proc is done
ue->dlsch_p[gNB_id]->active = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_P, VCD_FUNCTION_OUT);
}
@@ -1904,15 +1938,11 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1)) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_IN);
nr_ue_pdsch_procedures(ue,
proc,
gNB_id,
RA_PDSCH,
ue->dlsch_ra[gNB_id],
NULL);
// #if UE_TIMING_TRACE
// start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]);
// #endif
proc,
gNB_id,
RA_PDSCH,
ue->dlsch_ra[gNB_id],
NULL);
nr_ue_dlsch_procedures(ue,
proc,
@@ -1923,18 +1953,10 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
&ue->dlsch_ra_errors[gNB_id],
mode);
// #if UE_TIMING_TRACE
// stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[nr_tti_rx]]);
#if DISABLE_LOG_X
printf("[SFN %d] Slot1: Pdsch Proc %5.2f\n", nr_tti_rx, ue->pdsch_procedures_stat[ue->current_thread_id[nr_tti_rx]].p_time/(cpuf*1000.0));
printf("[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n", nr_tti_rx, ue->dlsch_procedures_stat[ue->current_thread_id[ nr_tti_rx]].p_time/(cpuf*1000.0));
#else
LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n", nr_tti_rx, ue->pdsch_procedures_stat[ue->current_thread_id[ nr_tti_rx]].p_time/(cpuf*1000.0));
LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n", nr_tti_rx, ue->dlsch_procedures_stat[ue->current_thread_id[ nr_tti_rx]].p_time/(cpuf*1000.0));
#endif
// #endif
// deactivate dlsch once dlsch proc is done
ue->dlsch_ra[gNB_id]->active = 0;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC_RA, VCD_FUNCTION_OUT);
}
// do procedures for C-RNTI
@@ -2001,71 +2023,8 @@ start_meas(&ue->generic_stat);
}
#endif
// do procedures for SI-RNTI
if ((ue->dlsch_SI[gNB_id]) && (ue->dlsch_SI[gNB_id]->active == 1)) {
nr_ue_pdsch_procedures(ue,
proc,
gNB_id,
SI_PDSCH,
ue->dlsch_SI[gNB_id],
NULL);
/*ue_dlsch_procedures(ue,
proc,
gNB_id,
SI_PDSCH,
ue->dlsch_SI[gNB_id],
NULL,
&ue->dlsch_SI_errors[gNB_id],
mode,
abstraction_flag);
ue->dlsch_SI[gNB_id]->active = 0;*/
}
// do procedures for P-RNTI
if ((ue->dlsch_p[gNB_id]) && (ue->dlsch_p[gNB_id]->active == 1)) {
nr_ue_pdsch_procedures(ue,
proc,
gNB_id,
P_PDSCH,
ue->dlsch_p[gNB_id],
NULL);
/*ue_dlsch_procedures(ue,
proc,
gNB_id,
P_PDSCH,
ue->dlsch_p[gNB_id],
NULL,
&ue->dlsch_p_errors[gNB_id],
mode,
abstraction_flag);*/
ue->dlsch_p[gNB_id]->active = 0;
}
// do procedures for RA-RNTI
if ((ue->dlsch_ra[gNB_id]) && (ue->dlsch_ra[gNB_id]->active == 1)) {
nr_ue_pdsch_procedures(ue,
proc,
gNB_id,
RA_PDSCH,
ue->dlsch_ra[gNB_id],
NULL);
/*ue_dlsch_procedures(ue,
proc,
gNB_id,
RA_PDSCH,
ue->dlsch_ra[gNB_id],
NULL,
&ue->dlsch_ra_errors[gNB_id],
mode,
abstraction_flag);*/
ue->dlsch_ra[gNB_id]->active = 0;
}
// duplicate harq structure
/*
/*
uint8_t current_harq_pid = ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->current_harq_pid;
NR_DL_UE_HARQ_t *current_harq_processes = ue->dlsch[ue->current_thread_id[nr_tti_rx]][gNB_id][0]->harq_processes[current_harq_pid];
NR_DL_UE_HARQ_t *harq_processes_dest = ue->dlsch[next1_thread_id][gNB_id][0]->harq_processes[current_harq_pid];
@@ -2193,6 +2152,11 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN);
if (!prach_resources->init_msg1 && (frame_tx == (ue->prach_resources[gNB_id]->sync_frame + 150) % MAX_FRAME_NUMBER)){
ue->prach_cnt = 0;
prach_resources->init_msg1 = 1;
}
if (ue->mac_enabled == 0){
// prach_resources->ra_PreambleIndex = preamble_tx;
prach_resources->ra_TDD_map_index = 0;
@@ -2209,15 +2173,10 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
ue->ulsch_Msg3_active[i] = 0;
}
}
nr_prach = nr_ue_get_rach(ue->prach_resources[gNB_id], mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_tti_tx);
nr_prach = nr_ue_get_rach(ue->prach_resources[gNB_id], &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_tti_tx);
}
}
if (!prach_resources->init_msg1 && (frame_tx > ue->prach_resources[gNB_id]->sync_frame + 150)){
ue->prach_cnt = 0;
prach_resources->init_msg1 = 1;
}
if (ue->prach_resources[gNB_id] != NULL && nr_prach == 1 && prach_resources->init_msg1) {
pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
+146 -34
View File
@@ -37,6 +37,8 @@
#include "PHY/defs_nr_UE.h"
#include <openair1/SCHED/sched_common.h>
#include <openair1/PHY/NR_UE_TRANSPORT/pucch_nr.h>
#include "openair2/LAYER2/NR_MAC_UE/mac_proto.h"
#include "openair1/PHY/NR_UE_ESTIMATION/nr_estimation.h"
#ifndef NO_RAT_NR
@@ -54,6 +56,44 @@
uint8_t nr_is_cqi_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
uint8_t nr_is_ri_TXOp(PHY_VARS_NR_UE *ue,UE_nr_rxtx_proc_t *proc,uint8_t gNB_id);
long
binary_search_float_nr(
float elements[],
long numElem,
float value
)
//-----------------------------------------------------------------------------
{
long first, last, middle;
first = 0;
last = numElem-1;
middle = (first+last)/2;
if(value < elements[0]) {
return first;
}
if(value >= elements[last]) {
return last;
}
while (last - first > 1) {
if (elements[middle] > value) {
last = middle;
} else {
first = middle;
}
middle = (first+last)/2;
}
if (first < 0 || first >= numElem) {
LOG_E(RRC,"\n Error in binary search float!");
}
return first;
}
/*
void nr_generate_pucch0(int32_t **txdataF,
NR_DL_FRAME_PARMS *frame_parms,
@@ -241,7 +281,17 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
ri_status = ((ue->cqi_report_config[gNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) &&
(nr_is_ri_TXOp(ue,proc,gNB_id) == 1));
csi_status = get_csi_nr(ue, gNB_id, &csi_payload);
NR_CSI_MeasConfig_t *csi_MeasConfig = mac->scg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
uint16_t report_slot_csi =csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320;
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
if (report_slot_csi == proc->nr_tti_tx)
csi_status = get_csi_nr(mac, ue, gNB_id, &csi_payload);
else
csi_status = 0;
//}
O_CSI = cqi_status + ri_status + csi_status;
@@ -397,7 +447,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
}
int max_code_rate = 0;
int Q_m = BITS_PER_SYMBOL_QPSK; /* default pucch modulation type is QPSK with 2 bits per symbol */
//int Q_m = BITS_PER_SYMBOL_QPSK; /* default pucch modulation type is QPSK with 2 bits per symbol */
int N_sc_ctrl_RB = 0;
int O_CRC = 0;
@@ -426,18 +476,18 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
case pucch_format3_nr:
{
nb_of_prbs = pucch_resource->format.choice.format3->nrofPRBs;
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3->choice.setup->pi2BPSK[0] == 1) {
Q_m = BITS_PER_SYMBOL_BPSK; /* set bpsk modulation type with 1 bit per modulation symbol */
}
//if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format3->choice.setup->pi2BPSK[0] == 1) {
// Q_m = BITS_PER_SYMBOL_BPSK; /* set bpsk modulation type with 1 bit per modulation symbol */
//}
N_sc_ctrl_RB = N_SC_RB;
nb_symbols = nb_symbols_excluding_dmrs[nb_symbols_total-4][index_additional_dmrs][index_hopping];
break;
}
case pucch_format4_nr:
{
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4->choice.setup->pi2BPSK[0] == 1) {
Q_m = BITS_PER_SYMBOL_BPSK; /* set bpsk modulation type with 1 bit per modulation symbol */
}
//if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->format4->choice.setup->pi2BPSK[0] == 1) {
// Q_m = BITS_PER_SYMBOL_BPSK; /* set bpsk modulation type with 1 bit per modulation symbol */
//}
nb_symbols = nb_symbols_excluding_dmrs[nb_symbols_total-4][index_additional_dmrs][index_hopping];
nb_of_prbs = 1;
subframe_number = nr_tti_tx/(ue->frame_parms.slots_per_subframe);//ttis_per_subframe);
@@ -464,26 +514,27 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
/* TS 38.212 6.3.1.2 Code block segmentation and CRC attachment */
/* crc attachment can be done depending of payload size */
if (N_UCI < 11) {
O_CRC = 0; /* no additional crc bits */
}
else if ((N_UCI >= 12) && (N_UCI <= 19)) {
O_CRC = 6; /* number of additional crc bits */
}
else if (N_UCI >= 20) {
O_CRC = 11; /* number of additional crc bits */
}
// if (N_UCI < 11) {
// O_CRC = 0; /* no additional crc bits */
// }
// else if ((N_UCI >= 12) && (N_UCI <= 19)) {
// O_CRC = 6; /* number of additional crc bits */
// }
// else if (N_UCI >= 20) {
// O_CRC = 11; /* number of additional crc bits */
// }
N_UCI = N_UCI + O_CRC;
/* for format 2 and 3, number of prb should be adjusted to minimum value which cope to information size */
if (nb_of_prbs > 1 ) {
/*if (nb_of_prbs > 1 ) {
int nb_prb_min = 0;
int payload_in_bits;
do {
nb_prb_min++;
payload_in_bits = (nb_prb_min * N_sc_ctrl_RB * nb_symbols * Q_m * max_code_rate)/100; /* code rate has been multiplied by 100 */
NR_TST_PHY_PRINTF("PUCCH Adjust number of prb : (N_UCI : %d ) (payload_in_bits : %d) (N_sc_ctrl_RB : %d) (nb_symbols : %d) (Q_m : %d) (max_code_rate*100 : %d) \n",
payload_in_bits = (nb_prb_min * N_sc_ctrl_RB * nb_symbols * Q_m * max_code_rate)/100; */ /* code rate has been multiplied by 100 */
/*NR_TST_PHY_PRINTF("PUCCH Adjust number of prb : (N_UCI : %d ) (payload_in_bits : %d) (N_sc_ctrl_RB : %d) (nb_symbols : %d) (Q_m : %d) (max_code_rate*100 : %d) \n",
N_UCI, payload_in_bits, N_sc_ctrl_RB, nb_symbols, Q_m, max_code_rate);
} while (N_UCI > payload_in_bits);
@@ -494,7 +545,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
else {
nb_of_prbs = nb_prb_min;
}
}
}*/
/* TS 38.213 9.2.4 for a positive SR transmission, payload b(0) = 0 */
if ((O_SR == 1) && (format == pucch_format1_nr)) {
@@ -986,7 +1037,10 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
current_resource_id = r_PUCCH;
}
else {
current_resource_id = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0];
if (pucch_resource_set_id !=0 )
current_resource_id = 3; //TBC mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->resourceList.list.array[pucch_resource_indicator][0];
else
current_resource_id = 1;
}
}
@@ -1050,7 +1104,7 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size)
{
int pucch_resource_set_id = 0;
long *pucch_max_pl_bits = NULL;
//long *pucch_max_pl_bits = NULL;
/* from TS 38.331 field maxPayloadMinus1
-- Maximum number of payload bits minus 1 that the UE may transmit using this PUCCH resource set. In a PUCCH occurrence, the UE
@@ -1062,9 +1116,15 @@ int find_pucch_resource_set(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, int uci_size)
/* look for the first resource set which supports uci_size number of bits for payload */
while (pucch_resource_set_id < MAX_NB_OF_PUCCH_RESOURCE_SETS) {
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id] != NULL) {
pucch_max_pl_bits = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->maxPayloadMinus1;
if (uci_size <= (((pucch_max_pl_bits != NULL) ? *pucch_max_pl_bits : 1706) + 1)) {
NR_TST_PHY_PRINTF("PUCCH found resource set %d \n", pucch_resource_set_id);
//pucch_max_pl_bits = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set_id]->maxPayloadMinus1;
if (uci_size <= 2) { //TBC rrc (((pucch_max_pl_bits != NULL) ? *pucch_max_pl_bits : 1706) + 1)) {
//NR_TST_PHY_PRINTF("PUCCH found resource set %d max bits %d\n", pucch_resource_set_id, pucch_max_pl_bits);
pucch_resource_set_id = 0;
return (pucch_resource_set_id);
break;
}
else {
pucch_resource_set_id = 1;
return (pucch_resource_set_id);
break;
}
@@ -1096,7 +1156,7 @@ boolean_t check_pucch_format(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, pucch_format
{
pucch_format_nr_t selected_pucch_format;
pucch_format_nr_t selected_pucch_format_second;
NR_SetupRelease_PUCCH_FormatConfig_t *identified_format = NULL;
/*NR_SetupRelease_PUCCH_FormatConfig_t *identified_format = NULL;
switch (format_pucch) {
case pucch_format1_nr:
@@ -1121,12 +1181,12 @@ boolean_t check_pucch_format(NR_UE_MAC_INST_t *mac, uint8_t gNB_id, pucch_format
default:
break;
}
}*/
if ((identified_format != NULL) && (identified_format->choice.setup->nrofSlots[0] != 1)) {
/* if ((identified_format != NULL) && (identified_format->choice.setup->nrofSlots[0] != 1)) {
LOG_E(PHY,"PUCCH not implemented multislots transmission : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
return (FALSE);
}
}*/
if (nb_symbols_for_tx <= 2) {
if (uci_size <= 2) {
@@ -1247,19 +1307,68 @@ uint32_t dummy_csi_payload = 0;
/* FFS TODO_NR code that should be developed */
int get_csi_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint32_t *csi_payload)
uint16_t get_nr_csi_bitlen(NR_UE_MAC_INST_t *mac) {
uint16_t csi_bitlen =0;
uint16_t rsrp_bitlen = 0;
uint16_t diff_rsrp_bitlen = 0;
uint16_t nb_ssbri_cri = 0;
uint16_t cri_ssbri_bitlen = 0;
NR_CSI_MeasConfig_t *csi_MeasConfig = mac->scg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
struct NR_CSI_ResourceConfig__csi_RS_ResourceSetList__nzp_CSI_RS_SSB * nzp_CSI_RS_SSB = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[0]->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB;
uint16_t nb_csi_ssb_report = nzp_CSI_RS_SSB->csi_SSB_ResourceSetList!=NULL ? nzp_CSI_RS_SSB->csi_SSB_ResourceSetList->list.count:0;
if (0 != nb_csi_ssb_report){
uint8_t nb_ssb_resources =0;
if (NULL != csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)
nb_ssbri_cri = *(csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->groupBasedBeamReporting.choice.disabled->nrofReportedRS)+1;
else
nb_ssbri_cri = 1;
nb_ssb_resources = csi_MeasConfig->csi_SSB_ResourceSetToAddModList->list.array[0]->csi_SSB_ResourceList.list.count;
if (nb_ssb_resources){
cri_ssbri_bitlen =ceil(log2 (nb_ssb_resources));
rsrp_bitlen = 7;
diff_rsrp_bitlen = 4;
}
else{
cri_ssbri_bitlen =0;
rsrp_bitlen = 0;
diff_rsrp_bitlen = 0;
}
csi_bitlen = ((cri_ssbri_bitlen * nb_ssbri_cri) + rsrp_bitlen +(diff_rsrp_bitlen *(nb_ssbri_cri -1 ))) *nb_csi_ssb_report;
//printf("get csi bitlen %d nb_ssbri_cri %d nb_csi_report %d nb_resources %d\n", csi_bitlen,nb_ssbri_cri ,nb_csi_ssb_report, nb_ssb_resources);
}
return csi_bitlen;
}
int get_csi_nr(NR_UE_MAC_INST_t *mac, PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint32_t *csi_payload)
{
VOID_PARAMETER ue;
VOID_PARAMETER gNB_id;
float rsrp_db[7];
int nElem = 98;
int rsrp_offset = 17;
int csi_status = 0;
csi_status = get_nr_csi_bitlen(mac);
rsrp_db[0] = get_nr_RSRP(0,0,0);
if (dummy_csi_status == 0) {
if (csi_status == 0) {
*csi_payload = 0;
}
else {
*csi_payload = dummy_csi_payload;
*csi_payload = binary_search_float_nr(RSRP_meas_mapping_nr,nElem, rsrp_db[0]) + rsrp_offset;
}
return (dummy_csi_status);
return (csi_status);
}
/* FFS TODO_NR code that should be removed */
@@ -1326,6 +1435,9 @@ int get_ics_pucch(NR_PUCCH_Resource_t *pucch_resource, pucch_format_nr_t format_
case pucch_format1_nr:
return pucch_resource->format.choice.format1->initialCyclicShift;
case pucch_format2_nr:
return 0;
default:
return -1;
+108 -1
View File
@@ -60,6 +60,111 @@
/************** VARIABLES *****************************************/
float RSRP_meas_mapping_nr[98]
#ifdef INIT_VARIABLES_PUCCH_UE_NR_H
= {
-140,
-139,
-138,
-137,
-136,
-135,
-134,
-133,
-132,
-131,
-130,
-129,
-128,
-127,
-126,
-125,
-124,
-123,
-122,
-121,
-120,
-119,
-118,
-117,
-116,
-115,
-114,
-113,
-112,
-111,
-110,
-109,
-108,
-107,
-106,
-105,
-104,
-103,
-102,
-101,
-100,
-99,
-98,
-97,
-96,
-95,
-94,
-93,
-92,
-91,
-90,
-89,
-88,
-87,
-86,
-85,
-84,
-83,
-82,
-81,
-80,
-79,
-78,
-77,
-76,
-75,
-74,
-73,
-72,
-71,
-70,
-69,
-68,
-67,
-66,
-65,
-64,
-63,
-62,
-61,
-60,
-59,
-58,
-57,
-56,
-55,
-54,
-53,
-52,
-51,
-50,
-49,
-48,
-47,
-46,
-45,
-44,
-43
}
#endif
;
/* TS 36.213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */
const initial_pucch_resource_t initial_pucch_resource[NB_INITIAL_PUCCH_RESOURCE]
#ifdef INIT_VARIABLES_PUCCH_UE_NR_H
@@ -226,12 +331,14 @@ int trigger_periodic_scheduling_request(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_n
@param csi_payload is updated with CSI
@returns number of bits of CSI */
int get_csi_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint32_t *csi_payload);
int get_csi_nr(NR_UE_MAC_INST_t *mac, PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint32_t *csi_payload);
/** \brief This dummy function sets current CSI for simulation
@param csi_status
@param csi_payload is updated with CSI
@returns none */
uint16_t get_nr_csi_bitlen(NR_UE_MAC_INST_t *mac);
void set_csi_nr(int csi_status, uint32_t csi_payload);
+11 -2
View File
@@ -140,6 +140,12 @@ int generate_dlsch_header(unsigned char *mac_header,
unsigned char short_padding,
unsigned short post_padding){return 0;}
// Dummy function to avoid linking error at compilation of nr-dlsim
int is_x2ap_enabled(void)
{
return 0;
}
// needed for some functions
openair0_config_t openair0_cfg[MAX_CARDS];
@@ -531,13 +537,14 @@ int main(int argc, char **argv)
uint64_t ssb_bitmap;
fill_scc(rrc.carrier.servingcellconfigcommon,&ssb_bitmap,N_RB_DL,N_RB_DL,mu,mu);
fix_scc(scc,ssb_bitmap);
fill_default_secondaryCellGroup(scc,
secondaryCellGroup,
0,
1,
n_tx,
0);
fix_scc(scc,ssb_bitmap);
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup);
@@ -778,6 +785,8 @@ int main(int argc, char **argv)
UE_info->UE_sched_ctrl[0].harq_processes[harq_pid].round = round;
UE_info->UE_sched_ctrl[0].current_harq_pid = harq_pid;
gNB->dlsch[0][0]->harq_processes[harq_pid]->round = round;
for (int i=0; i<MAX_NUM_CORESET; i++)
gNB_mac->UE_info.num_pdcch_cand[0][i] = 0;
if (css_flag == 0) nr_schedule_uss_dlsch_phytest(0,frame,slot,&pucch_sched,&dlsch_config);
else nr_schedule_css_dlsch_phytest(0,frame,slot);
@@ -1038,7 +1047,7 @@ int main(int argc, char **argv)
}
//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");
break;
}
+1
View File
@@ -35,6 +35,7 @@
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "PHY/MODULATION/modulation_eNB.h"
#include "PHY/MODULATION/modulation_UE.h"
#include "PHY/MODULATION/nr_modulation.h"
#include "PHY/INIT/phy_init.h"
#include "PHY/NR_TRANSPORT/nr_transport_proto.h"
#include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h"
+63 -56
View File
@@ -100,6 +100,12 @@ rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, const int CC_id, const uint8_t gNB_index, const int8_t channel, const uint8_t* pduP, const sdu_size_t pdu_len) {return 0;}
// Dummy function to avoid linking error at compilation of nr-prachsim
int is_x2ap_enabled(void)
{
return 0;
}
int main(int argc, char **argv){
char c;
@@ -113,6 +119,10 @@ int main(int argc, char **argv){
uint16_t Nid_cell = 0, preamble_tx = 0, preamble_delay, format, format0, format1;
uint32_t tx_lev = 10000, prach_errors = 0, samp_count; //,tx_lev_dB;
uint64_t SSB_positions = 0x01, absoluteFrequencyPointA = 640000;
uint16_t RA_sfn_index;
uint8_t N_RA_slot;
uint8_t config_period;
int prachOccasion = 0;
double DS_TDL = .03;
// int8_t interf1=-19,interf2=-19;
@@ -428,15 +438,18 @@ int main(int argc, char **argv){
gNB->proc.slot_rx = slot;
int ret = get_nr_prach_info_from_index(config_index,
(int)frame,
(int)slot_gNB,
absoluteFrequencyPointA,
mu,
frame_parms->frame_type,
&format,
&start_symbol,
&N_t_slot,
&N_dur);
(int)frame,
(int)slot_gNB,
absoluteFrequencyPointA,
mu,
frame_parms->frame_type,
&format,
&start_symbol,
&N_t_slot,
&N_dur,
&RA_sfn_index,
&N_RA_slot,
&config_period);
if (ret == 0) {printf("No prach in %d.%d, mu %d, config_index %d\n",frame,slot,mu,config_index); exit(-1);}
format0 = format&0xff; // first column of format from table
@@ -445,60 +458,54 @@ int main(int argc, char **argv){
if (format1 != 0xff) {
switch(format0) {
case 0xa1:
prach_format = 9;
prach_format = 11;
break;
case 0xa2:
prach_format = 10;
prach_format = 12;
break;
case 0xa3:
prach_format = 11;
prach_format = 13;
break;
default:
AssertFatal(1==0, "Only formats A1/B1 A2/B2 A3/B3 are valid for dual format");
}
} else {
switch(format0) {
case 0xa1:
prach_format = 0;
break;
case 0xa2:
prach_format = 1;
break;
case 0xa3:
prach_format = 2;
break;
case 0xb1:
prach_format = 3;
break;
case 0xb2:
prach_format = 4;
break;
case 0xb3:
prach_format = 5;
break;
case 0xb4:
prach_format = 6;
break;
case 0xc0:
prach_format = 7;
break;
case 0xc2:
prach_format = 8;
break;
case 0:
// long formats are handled @ PHY
break;
case 1:
// long formats are handled @ PHY
break;
case 2:
// long formats are handled @ PHY
break;
case 3:
// long formats are handled @ PHY
break;
switch(format0) { // single PRACH format
case 0:
prach_format = 0;
break;
case 1:
prach_format = 1;
break;
case 2:
prach_format = 2;
break;
case 3:
prach_format = 3;
break;
case 0xa1:
prach_format = 4;
break;
case 0xa2:
prach_format = 5;
break;
case 0xa3:
prach_format = 6;
break;
case 0xb1:
prach_format = 7;
break;
case 0xb4:
prach_format = 8;
break;
case 0xc0:
prach_format = 9;
break;
case 0xc2:
prach_format = 10;
break;
default:
AssertFatal(1==0, "Invalid PRACH format");
AssertFatal(1 == 0, "Invalid PRACH format");
}
}
@@ -721,11 +728,11 @@ int main(int argc, char **argv){
}
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, frame, slot);
rx_nr_prach_ru(ru, prach_format, numRA, prachStartSymbol, prachOccasion, frame, slot);
gNB->prach_vars.rxsigF = ru->prach_rxsigF;
gNB->prach_vars.rxsigF = ru->prach_rxsigF[prachOccasion];
if (n_frames == 1) printf("ncs %d,num_seq %d\n",prach_pdu->num_cs, prach_config->num_prach_fd_occasions_list[fd_occasion].num_root_sequences.value);
rx_nr_prach(gNB, prach_pdu, frame, subframe, &preamble_rx, &preamble_energy, &preamble_delay);
rx_nr_prach(gNB, prach_pdu, prachOccasion, frame, subframe, &preamble_rx, &preamble_energy, &preamble_delay);
// printf(" preamble_energy %d preamble_rx %d preamble_tx %d \n", preamble_energy, preamble_rx, preamble_tx);
+8 -1
View File
@@ -119,6 +119,12 @@ rrc_gNB_process_GTPV1U_CREATE_TUNNEL_RESP(
return 0;
}
// Dummy function to avoid linking error at compilation of nr-ulsim
int is_x2ap_enabled(void)
{
return 0;
}
// needed for some functions
uint16_t n_rnti = 0x1234;
openair0_config_t openair0_cfg[MAX_CARDS];
@@ -559,13 +565,14 @@ int main(int argc, char **argv)
uint64_t ssb_bitmap;
fill_scc(rrc.carrier.servingcellconfigcommon,&ssb_bitmap,N_RB_DL,N_RB_DL,mu,mu);
fix_scc(scc,ssb_bitmap);
fill_default_secondaryCellGroup(scc,
secondaryCellGroup,
0,
1,
n_tx,
0);
fix_scc(scc,ssb_bitmap);
// xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup);
-13
View File
@@ -65,18 +65,6 @@
#define MAX_NR_RRC_UE_CONTEXTS 64
#ifndef UE_EXPANSION
// TODO:L2 FAPI simulator.
// UESIM_EXPANSION is used to be same value of MAX_MOBILES_PER_ENB
// in eNB and UE.
// now , if we use --mu option in UE, compiling error will occur.
// This problem will be fixed in the future.
#ifdef UESIM_EXPANSION
#define MAX_MOBILES_PER_ENB 256
#define MAX_MOBILES_PER_ENB_NB_IoT 256
#define MAX_MOBILES_PER_GNB 256
#define MAX_eNB 2
#define MAX_gNB 2
#else
#ifdef LARGE_SCALE
#define MAX_MOBILES_PER_ENB 128
#define MAX_MOBILES_PER_ENB_NB_IoT 128
@@ -90,7 +78,6 @@
#define MAX_eNB 2
#define MAX_gNB 2
#endif
#endif
#else
#define MAX_MOBILES_PER_ENB 256
#define MAX_MOBILES_PER_ENB_NB_IoT 256
@@ -40,6 +40,8 @@
#include "common/utils/LOG/log.h"
#include <dlfcn.h>
/*Array containing the Agent-MAC interfaces*/
AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB];
@@ -53,10 +55,20 @@ struct lfds700_ringbuffer_state ringbuffer_state[NUM_MAX_ENB];
struct lfds700_ringbuffer_element *slice_config_array[NUM_MAX_ENB];
struct lfds700_ringbuffer_state slice_config_ringbuffer_state[NUM_MAX_ENB];
/* Ringbuffer related to slice configuration if we need to wait for additional
* controller information */
struct lfds700_ringbuffer_element *store_slice_config_array[NUM_MAX_ENB];
struct lfds700_ringbuffer_state store_slice_config_ringbuffer_state[NUM_MAX_ENB];
/* stores the (increasing) xid for messages to prevent double use */
int xid = 50;
/* Ringbuffer-related to slice configuration */
struct lfds700_ringbuffer_element *ue_assoc_array[NUM_MAX_ENB];
struct lfds700_ringbuffer_state ue_assoc_ringbuffer_state[NUM_MAX_ENB];
/* a list of shared objects that are loaded into the user plane */
SLIST_HEAD(flexran_so_handle, flexran_agent_so_handle_s) flexran_handles[NUM_MAX_ENB];
int flexran_agent_mac_stats_reply_ue(mid_t mod_id,
Protocol__FlexUeStatsReport **ue_report,
int n_ue,
@@ -1363,6 +1375,19 @@ void flexran_agent_init_mac_agent(mid_t mod_id) {
&scrng,
NULL);
struct lfds700_misc_prng_state sscrng;
i = posix_memalign((void **) &store_slice_config_array[mod_id],
LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES,
sizeof(struct lfds700_ringbuffer_element) * num_elements);
AssertFatal(i == 0,
"posix_memalign(): could not allocate aligned memory\n");
lfds700_ringbuffer_init_valid_on_current_logical_core(
&store_slice_config_ringbuffer_state[mod_id],
store_slice_config_array[mod_id],
num_elements,
&sscrng,
NULL);
struct lfds700_misc_prng_state uarng;
i = posix_memalign((void **) &ue_assoc_array[mod_id],
LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES,
@@ -1382,6 +1407,8 @@ void flexran_agent_init_mac_agent(mid_t mod_id) {
RC.mac[mod_id]->UE_info.eNB_UE_stats[UE_PCCID(mod_id,i)][i].harq_pid = 0;
}
}
SLIST_INIT(&flexran_handles[mod_id]);
}
/***********************************************
@@ -1659,6 +1686,8 @@ int flexran_agent_unregister_mac_xface(mid_t mod_id)
free(dl_mac_config_array[mod_id]);
lfds700_ringbuffer_cleanup(&slice_config_ringbuffer_state[mod_id], NULL );
free(slice_config_array[mod_id]);
lfds700_ringbuffer_cleanup(&store_slice_config_ringbuffer_state[mod_id], NULL );
free(store_slice_config_array[mod_id]);
lfds700_ringbuffer_cleanup(&ue_assoc_ringbuffer_state[mod_id], NULL );
free(ue_assoc_array[mod_id]);
lfds700_misc_library_cleanup();
@@ -1698,7 +1727,81 @@ void helper_destroy_mac_slice_config(Protocol__FlexSliceConfig *slice_config) {
flexran_agent_destroy_mac_slice_config(&helper);
}
void prepare_update_slice_config(mid_t mod_id, Protocol__FlexSliceConfig **slice_config) {
int check_scheduler(mid_t mod_id, char *s) {
if (!s)
return 1;
if (dlsym(NULL, s))
return 1;
flexran_agent_so_handle_t *so = NULL;
SLIST_FOREACH(so, &flexran_handles[mod_id], entries) {
if (strcmp(so->name, s) == 0)
return 1;
}
return 0;
}
void request_scheduler(mid_t mod_id, char *s, int xid) {
LOG_W(FLEXRAN_AGENT,
"unknown scheduler %s, requesting controller to send it\n",
s);
Protocol__FlexControlDelegationRequest *req = malloc(sizeof(Protocol__FlexControlDelegationRequest));
DevAssert(req);
protocol__flex_control_delegation_request__init(req);
Protocol__FlexHeader *header = NULL;
int rc = flexran_create_header(
xid, PROTOCOL__FLEX_TYPE__FLPT_DELEGATE_REQUEST, &header);
AssertFatal(rc == 0, "%s(): cannot create header\n", __func__);
req->header = header;
req->delegation_type = PROTOCOL__FLEX_CONTROL_DELEGATION_TYPE__FLCDT_MAC_DL_UE_SCHEDULER;
req->name = strdup(s);
Protocol__FlexranMessage *msg = malloc(sizeof(Protocol__FlexranMessage));
DevAssert(msg);
protocol__flexran_message__init(msg);
msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DEL_REQ_MSG;
msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
msg->control_del_req_msg = req;
int size = 0;
void *data = flexran_agent_pack_message(msg, &size);
if (flexran_agent_msg_send(mod_id, FLEXRAN_AGENT_DEFAULT, data, size, 0) < 0)
LOG_E(FLEXRAN_AGENT, "%s(): error while sending message\n", __func__);
}
Protocol__FlexranMessage *request_scheduler_timeout(
mid_t mod_id,
const Protocol__FlexranMessage *msg) {
const Protocol__FlexEnbConfigReply *ecr = msg->enb_config_reply_msg;
struct lfds700_misc_prng_state ls;
LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE;
lfds700_misc_prng_init(&ls);
Protocol__FlexranMessage *smsg = NULL;
struct lfds700_ringbuffer_state *state = &store_slice_config_ringbuffer_state[mod_id];
if (lfds700_ringbuffer_read(state, NULL, (void **) &smsg, &ls)) {
AssertFatal(msg == smsg,
"expected and returned enb_config_reply are not the same\n");
AssertFatal(ecr->header->xid == smsg->enb_config_reply_msg->header->xid,
"expected and returned enb_config_reply are not the same\n");
} else {
LOG_E(FLEXRAN_AGENT, "%s(): could not read config from ringbuffer\n", __func__);
}
/* call the helper so that scheduler names are correctly freed */
helper_destroy_mac_slice_config(ecr->cell_config[0]->slice_config);
ecr->cell_config[0]->slice_config = NULL;
/* we should not call flexran_agent_destroy_enb_config_reply(smsg); since
* upon timer removal, this is automatically done */
LOG_W(FLEXRAN_AGENT,
"remove stored slice config (xid %d) after timeout\n",
ecr->header->xid);
flexran_agent_destroy_timer(mod_id, ecr->header->xid);
return NULL;
}
void prepare_update_slice_config(mid_t mod_id,
Protocol__FlexSliceConfig **slice_config,
int request_objects) {
if (!*slice_config) return;
/* just use the memory and set to NULL in original */
Protocol__FlexSliceConfig *sc = *slice_config;
@@ -1709,6 +1812,63 @@ void prepare_update_slice_config(mid_t mod_id, Protocol__FlexSliceConfig **slice
lfds700_misc_prng_init(&ls);
enum lfds700_misc_flag overwrite_occurred_flag;
int put_on_hold = 0;
if (request_objects
&& sc->dl->scheduler
&& !check_scheduler(mod_id, sc->dl->scheduler)) {
request_scheduler(mod_id, sc->dl->scheduler, xid++);
put_on_hold = 1;
}
for (int i = 0; request_objects && i < sc->dl->n_slices; ++i) {
Protocol__FlexSlice *sl = sc->dl->slices[i];
if (sl->scheduler && !check_scheduler(mod_id, sl->scheduler)) {
request_scheduler(mod_id, sl->scheduler, xid++);
put_on_hold = 1;
}
}
if (put_on_hold) {
Protocol__FlexEnbConfigReply *reply = malloc(sizeof(Protocol__FlexEnbConfigReply));
DevAssert(reply);
protocol__flex_enb_config_reply__init(reply);
/* use the last used xid so we can correlate answer and waiting config */
int rc = flexran_create_header(
xid - 1, PROTOCOL__FLEX_TYPE__FLPT_GET_ENB_CONFIG_REPLY, &reply->header);
AssertFatal(rc == 0, "%s(): cannot create header\n", __func__);
reply->n_cell_config = 1;
reply->cell_config = malloc(sizeof(Protocol__FlexCellConfig *));
DevAssert(reply->cell_config);
reply->cell_config[0] = malloc(sizeof(Protocol__FlexCellConfig));
DevAssert(reply->cell_config[0]);
protocol__flex_cell_config__init(reply->cell_config[0]);
reply->cell_config[0]->slice_config = sc;
Protocol__FlexranMessage *msg = malloc(sizeof(Protocol__FlexranMessage));
DevAssert(msg);
protocol__flexran_message__init(msg);
msg->msg_case = PROTOCOL__FLEXRAN_MESSAGE__MSG_ENB_CONFIG_REPLY_MSG;
msg->msg_dir = PROTOCOL__FLEXRAN_DIRECTION__INITIATING_MESSAGE;
msg->enb_config_reply_msg = reply;
Protocol__FlexEnbConfigReply *o;
lfds700_ringbuffer_write(&store_slice_config_ringbuffer_state[mod_id],
NULL,
(void *)msg,
&overwrite_occurred_flag,
NULL,
(void **) &o,
&ls);
AssertFatal(overwrite_occurred_flag == LFDS700_MISC_FLAG_LOWERED,
"unhandled: stored slice config for controller has been overwritten\n");
flexran_agent_create_timer(mod_id,
3000,
FLEXRAN_AGENT_TIMER_TYPE_PERIODIC,
xid - 1,
request_scheduler_timeout,
msg); /* need reply for xid */
return;
}
Protocol__FlexSliceConfig *overwritten_sc;
lfds700_ringbuffer_write(&slice_config_ringbuffer_state[mod_id],
NULL,
@@ -1756,6 +1916,69 @@ void flexran_agent_slice_update(mid_t mod_id) {
apply_update_dl_slice_config(mod_id, sc->dl);
apply_update_ul_slice_config(mod_id, sc->ul);
helper_destroy_mac_slice_config(sc);
flexran_agent_so_handle_t *so = NULL;
flexran_agent_so_handle_t *prev = NULL; // the previous to current element, if we delete in order to go back
//SLIST_FOREACH(so, &flexran_handles[mod_id], entries)
for(so = flexran_handles[mod_id].slh_first; so;) {
char *name = so->name;
int in_use = strcmp(flexran_get_dl_scheduler_name(mod_id), name) == 0
|| strcmp(flexran_get_ul_scheduler_name(mod_id), name) == 0;
Protocol__FlexSliceAlgorithm dl_algo = flexran_get_dl_slice_algo(mod_id);
if (!in_use && dl_algo != PROTOCOL__FLEX_SLICE_ALGORITHM__None) {
int n = flexran_get_num_dl_slices(mod_id);
for (int i = 0; i < n; ++i) {
Protocol__FlexSlice s;
/* NONE so it won't do any allocations */
flexran_get_dl_slice(mod_id, i, &s, PROTOCOL__FLEX_SLICE_ALGORITHM__None);
if (strcmp(s.scheduler, name) == 0) {
in_use = 1;
break;
}
}
}
Protocol__FlexSliceAlgorithm ul_algo = flexran_get_ul_slice_algo(mod_id);
if (!in_use && ul_algo != PROTOCOL__FLEX_SLICE_ALGORITHM__None) {
int n = flexran_get_num_ul_slices(mod_id);
for (int i = 0; i < n; ++i) {
Protocol__FlexSlice s;
/* NONE so it won't do any allocations */
flexran_get_ul_slice(mod_id, i, &s, PROTOCOL__FLEX_SLICE_ALGORITHM__None);
if (strcmp(s.scheduler, name) == 0) {
in_use = 1;
break;
}
}
}
if (!in_use) {
char s[512];
int rc = flexran_agent_map_name_to_delegated_object(mod_id, so->name, s, 512);
LOG_W(FLEXRAN_AGENT,
"removing %s (library handle %p) since it is not used in the user "
"plane anymore\n",
s,
so->dl_handle);
dlclose(so->dl_handle);
if (rc < 0) {
LOG_E(FLEXRAN_AGENT, "cannot map name %s\n", so->name);
} else {
int rc = remove(s);
if (rc < 0)
LOG_E(FLEXRAN_AGENT, "cannot remove file %s: %s\n", s, strerror(errno));
}
free (so->name);
if (!prev) { //it's the head, start over
SLIST_REMOVE_HEAD(&flexran_handles[mod_id], entries);
so = flexran_handles[mod_id].slh_first;
} else {
SLIST_REMOVE(&flexran_handles[mod_id], so, flexran_agent_so_handle_s, entries);
so = prev->entries.sle_next;
}
} else {
prev = so;
so = so->entries.sle_next;
}
}
}
Protocol__FlexUeConfig *ue_config = NULL;
@@ -1765,3 +1988,92 @@ void flexran_agent_slice_update(mid_t mod_id) {
free(ue_config);
}
}
void flexran_agent_mac_inform_delegation(mid_t mod_id,
Protocol__FlexControlDelegation *cdm) {
LOG_W(FLEXRAN_AGENT,
"received FlexControlDelegation message for object '%s' xid %d\n",
cdm->name,
cdm->header->xid);
if (cdm->header->xid < xid - 1) {
LOG_I(FLEXRAN_AGENT,
"waiting for %d more messages (up to xid %d)\n",
xid - 1 - cdm->header->xid,
xid - 1);
return;
}
/* should receive up to xid - 1, otherwise it means there was no request */
AssertFatal(xid > cdm->header->xid,
"received control delegation with xid %d that we never requested "
"(last request %d)\n",
cdm->header->xid,
xid - 1);
/* Load the library so the user plane can search it */
char s[512];
int rc = flexran_agent_map_name_to_delegated_object(mod_id, cdm->name, s, 512);
if (rc < 0) {
LOG_E(FLEXRAN_AGENT, "cannot map name %s\n", cdm->name);
return;
}
/* TODO where to unload/save handle?? */
void *h = dlopen(s, RTLD_NOW);
if (!h) {
LOG_E(FLEXRAN_AGENT, "dlopen(): %s\n", dlerror());
return;
}
LOG_I(FLEXRAN_AGENT, "library handle %p\n", h);
struct lfds700_misc_prng_state ls;
LFDS700_MISC_MAKE_VALID_ON_CURRENT_LOGICAL_CORE_INITS_COMPLETED_BEFORE_NOW_ON_ANY_OTHER_LOGICAL_CORE;
lfds700_misc_prng_init(&ls);
Protocol__FlexranMessage *msg = NULL;
struct lfds700_ringbuffer_state *state = &store_slice_config_ringbuffer_state[mod_id];
if (lfds700_ringbuffer_read(state, NULL, (void **) &msg, &ls) == 0) {
LOG_E(FLEXRAN_AGENT, "%s(): could not read config from ringbuffer\n", __func__);
return;
}
AssertFatal(cdm->header->xid == msg->enb_config_reply_msg->header->xid,
"expected and retrieved xid of stored slice configuration does "
"not match (expected %d, retrieved %d)\n",
cdm->header->xid,
msg->enb_config_reply_msg->header->xid);
/* Since we recover, stop the timeout */
rc = flexran_agent_destroy_timer(mod_id, cdm->header->xid);
prepare_update_slice_config(
mod_id,
&msg->enb_config_reply_msg->cell_config[0]->slice_config,
0 /* don't do a request */);
/* we should not call flexran_agent_destroy_enb_config_reply(smsg); since
* upon timer removal, this is automatically done.
* prepare_update_slice_config() takes ownership of the slice config, it is
* freed inside */
flexran_agent_so_handle_t *so = malloc(sizeof(flexran_agent_so_handle_t));
DevAssert(so);
so->name = strdup(cdm->name);
DevAssert(so->name);
so->dl_handle = h;
SLIST_INSERT_HEAD(&flexran_handles[mod_id], so, entries);
}
void flexran_agent_mac_fill_loaded_mac_objects(
mid_t mod_id,
Protocol__FlexEnbConfigReply *reply) {
int n = 0;
flexran_agent_so_handle_t *so = NULL;
SLIST_FOREACH(so, &flexran_handles[mod_id], entries)
++n;
reply->n_loadedmacobjects = n;
reply->loadedmacobjects = calloc(n, sizeof(char *));
if (!reply->loadedmacobjects) {
reply->n_loadedmacobjects = 0;
return;
}
n = 0;
SLIST_FOREACH(so, &flexran_handles[mod_id], entries)
reply->loadedmacobjects[n++] = so->name;
}
@@ -39,6 +39,12 @@
// for flexran_agent_get_mac_xface()
#include "flexran_agent_extern.h"
/* Type for a list of shared objects used in the user plane (schedulers) */
typedef struct flexran_agent_so_handle_s {
char *name; // name of the object
void *dl_handle; // handle of associated objects
SLIST_ENTRY (flexran_agent_so_handle_s) entries;
} flexran_agent_so_handle_t;
/* Initialization function for the agent structures etc */
void flexran_agent_init_mac_agent(mid_t mod_id);
@@ -117,7 +123,9 @@ void flexran_agent_slice_update(mid_t mod_id);
/* marks slice_config so that it can be applied later. Takes ownership of the
* FlexSliceConfig message */
void prepare_update_slice_config(mid_t mod_id, Protocol__FlexSliceConfig **slice);
void prepare_update_slice_config(mid_t mod_id,
Protocol__FlexSliceConfig **slice,
int request_objects);
/* inserts a new ue_config into the structure keeping ue to slice association
* updates and marks so it can be applied. Takes ownership of the FlexUeConfig message */
@@ -127,4 +135,13 @@ void prepare_ue_slice_assoc_update(mid_t mod_id, Protocol__FlexUeConfig **ue_con
* flexran_agent_fill_mac_cell_config() */
void flexran_agent_destroy_mac_slice_config(Protocol__FlexCellConfig *conf);
/* information about a new (potentially relevant) control delegation message */
void flexran_agent_mac_inform_delegation(mid_t mod_id,
Protocol__FlexControlDelegation *cdm);
/* fill the enb_config_reply with the shared objects in use by the MAC sublayer */
void flexran_agent_mac_fill_loaded_mac_objects(
mid_t mod_id,
Protocol__FlexEnbConfigReply *reply);
#endif
@@ -33,6 +33,9 @@
#include "flexran_agent_mac_internal.h"
#include "flexran_agent_mac_slice_verification.h"
extern SLIST_HEAD(flexran_so_handle,
flexran_agent_so_handle_s) flexran_handles[NUM_MAX_ENB];
Protocol__FlexranMessage * flexran_agent_generate_diff_mac_stats_report(Protocol__FlexranMessage *new_message,
Protocol__FlexranMessage *old_message) {
@@ -1025,6 +1028,19 @@ int load_dl_scheduler_function(mid_t mod_id, const char *function_name) {
}
void *search_so(mid_t mod_id, char *name) {
if (!name) // no name -> nothing to return, so use NULL for executable
return NULL;
if (dlsym(NULL, name)) // found it in executable
return NULL;
flexran_agent_so_handle_t *so = NULL;
SLIST_FOREACH(so, &flexran_handles[mod_id], entries) {
if (strcmp(so->name, name) == 0)
return so->dl_handle;
}
return NULL;
}
void update_or_remove_dl(mid_t mod_id, Protocol__FlexSlice *s) {
if (s->params_case == PROTOCOL__FLEX_SLICE__PARAMS__NOT_SET
&& !s->label && !s->scheduler) {
@@ -1033,8 +1049,12 @@ void update_or_remove_dl(mid_t mod_id, Protocol__FlexSlice *s) {
if (!rc)
LOG_W(FLEXRAN_AGENT, "error while removing slice ID %d\n", s->id);
} else {
LOG_I(FLEXRAN_AGENT, "updating DL slice ID %d\n", s->id);
const int rc = flexran_create_dl_slice(mod_id, s);
void *lib = search_so(mod_id, s->scheduler);
LOG_I(FLEXRAN_AGENT,
"updating DL slice ID %d (library handle %p)\n",
s->id,
lib);
const int rc = flexran_create_dl_slice(mod_id, s, lib);
if (rc < 0)
LOG_W(FLEXRAN_AGENT,
"error while update slice ID %d: flexran_create_dl_slice() -> %d\n",
@@ -1050,8 +1070,12 @@ void update_or_remove_ul(mid_t mod_id, Protocol__FlexSlice *s) {
if (!rc)
LOG_W(FLEXRAN_AGENT, "error while removing slice ID %d\n", s->id);
} else {
LOG_I(FLEXRAN_AGENT, "updating UL slice ID %d\n", s->id);
const int rc = flexran_create_ul_slice(mod_id, s);
void *lib = search_so(mod_id, s->scheduler);
LOG_I(FLEXRAN_AGENT,
"updating UL slice ID %d (library handle %p)\n",
s->id,
lib);
const int rc = flexran_create_ul_slice(mod_id, s, lib);
if (rc < 0)
LOG_W(FLEXRAN_AGENT,
"error while updating slice ID %d: flexran_create_ul_slice() -> %d)\n",
@@ -1099,8 +1123,12 @@ void apply_update_dl_slice_config(mid_t mod_id, Protocol__FlexSliceDlUlConfig *d
LOG_E(FLEXRAN_AGENT, "cannot update scheduling algorithm: slice algorithm loaded\n");
return;
}
LOG_I(FLEXRAN_AGENT, "loading DL new scheduling algorithm '%s'\n", dl->scheduler);
const int rc = flexran_set_dl_scheduler(mod_id, dl->scheduler);
void *lib = search_so(mod_id, dl->scheduler);
LOG_I(FLEXRAN_AGENT,
"loading DL new scheduling algorithm '%s' (library handle %p)\n",
dl->scheduler,
lib);
const int rc = flexran_set_dl_scheduler(mod_id, dl->scheduler, lib);
if (rc < 0) {
LOG_E(FLEXRAN_AGENT,
"error while updating scheduling algorithm: "
@@ -1147,8 +1175,12 @@ void apply_update_ul_slice_config(mid_t mod_id, Protocol__FlexSliceDlUlConfig *u
LOG_E(FLEXRAN_AGENT, "cannot update scheduling algorithm: slice algorithm loaded\n");
return;
}
LOG_I(FLEXRAN_AGENT, "loading new UL scheduling algorithm '%s'\n", ul->scheduler);
const int rc = flexran_set_ul_scheduler(mod_id, ul->scheduler);
void *lib = search_so(mod_id, ul->scheduler);
LOG_I(FLEXRAN_AGENT,
"loading new UL scheduling algorithm '%s' (library handle %p)\n",
ul->scheduler,
lib);
const int rc = flexran_set_ul_scheduler(mod_id, ul->scheduler, lib);
if (rc < 0) {
LOG_E(FLEXRAN_AGENT,
"error while updating scheduling algorithm: "
@@ -3,4 +3,25 @@ package protocol;
enum flex_control_delegation_type {
FLCDT_MAC_DL_UE_SCHEDULER = 1; // DL UE scheduler delegation
FLCDT_AGENT_CONTROL_APP = 2; // Generic control application
}
message flex_agent_reconfiguration_system {
optional string system = 1;
repeated flex_agent_reconfiguration_subsystem subsystems = 2;
}
message flex_agent_reconfiguration_subsystem {
optional string name = 1; // Name of the object (app name or user plane object)
optional string behavior = 2; // For an app: a callback in a shared library. For any other subsystem: an object name (shared library) with defined syntax.
map<string, flex_agent_reconfiguration_param> params = 3; // Param configurations depending on callback/shared library above.
}
message flex_agent_reconfiguration_param {
oneof param {
int32 integer = 1;
float floating = 2;
bool boolean = 3;
string str = 4;
}
}
+12 -1
View File
@@ -7,6 +7,7 @@ import "time_common.proto";
import "config_messages.proto";
import "controller_commands.proto";
import "config_common.proto";
import "control_delegation.proto";
message flexran_message {
optional flexran_direction msg_dir = 100;
@@ -32,6 +33,7 @@ message flexran_message {
flex_ul_mac_config ul_mac_config_msg = 19;
flex_disconnect disconnect_msg = 20;
flex_ho_command ho_command_msg = 21;
flex_control_delegation_request control_del_req_msg = 22;
}
}
@@ -157,6 +159,8 @@ message flex_enb_config_reply {
repeated flex_cell_config cell_config = 3;
optional uint32 device_spec = 4;
optional flex_s1ap_config s1ap = 5;
repeated string loadedApps = 6;
repeated string loadedMacObjects = 7;
}
message flex_ue_config_request {
@@ -225,11 +229,17 @@ message flex_ue_state_change {
message flex_control_delegation {
optional flex_header header = 1;
optional uint32 delegation_type = 2; // Bitmap of FLCDT_* flags
optional flex_control_delegation_type delegation_type = 2; // The delegated object type, decides about further processing
optional bytes payload = 3; // Byte array of shared lib containing the delegated functions
optional string name = 4; // The delegated functions names ordered based on bitmap flags
}
message flex_control_delegation_request {
optional flex_header header = 1;
optional flex_control_delegation_type delegation_type = 2;
optional string name = 4;
}
//
// Agent reconfiguration message
//
@@ -237,6 +247,7 @@ message flex_control_delegation {
message flex_agent_reconfiguration {
optional flex_header header = 1;
optional string policy = 2; // The policy changes using YAML syntax in string format
repeated flex_agent_reconfiguration_system systems = 3; // The policy changes.
}
// Extensions of the echo request and reply
@@ -44,5 +44,6 @@ enum flex_type {
FLPT_RECONFIGURE_AGENT = 16;
FLPT_RRC_TRIGGERING = 17;
FLPT_UL_MAC_CONFIG = 18;
FLPT_DELEGATE_REQUEST = 22;
}
+3 -1
View File
@@ -115,7 +115,6 @@ error:
return NULL;
}
int channel_container_init = 0;
int flexran_agent_start(mid_t mod_id)
{
@@ -233,6 +232,9 @@ int flexran_agent_start(mid_t mod_id)
agent_task_created = 1;
}
/* Init the app sublayer */
flexran_agent_app_init(mod_id);
pthread_mutex_init(&flexran->mutex_node_ctrl, NULL);
pthread_cond_init(&flexran->cond_node_ctrl, NULL);
+1
View File
@@ -41,6 +41,7 @@
#include "flexran_agent_rrc.h"
#include "flexran_agent_pdcp.h"
#include "flexran_agent_s1ap.h"
#include "flexran_agent_app.h"
#include "common/utils/LOG/log.h"
#include "assertions.h"
+207
View File
@@ -0,0 +1,207 @@
/*
* 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
*/
/*! \file flexran_agent_app.c
* \brief CM for handling of applications
* \author Robert Schmidt
* \date 2020
* \version 0.1
*/
#include "flexran_agent_app.h"
#include "queue.h"
#include <dlfcn.h>
/* app definition */
typedef struct flexran_agent_app_internal_s {
char *name;
void *dl_handle;
flexran_agent_app_t *app;
SLIST_ENTRY (flexran_agent_app_internal_s) entries;
} flexran_agent_app_internal_t;
/* a list of all apps */
SLIST_HEAD(flexran_apps_s, flexran_agent_app_internal_s) flexran_apps[NUM_MAX_ENB];
void flexran_agent_app_init(mid_t mod_id) {
//flexran_apps[mod_id] = SLIST_HEAD_INITIALIZER(flexran_apps[mod_id]);
SLIST_INIT(&flexran_apps[mod_id]);
}
int flexran_agent_start_app_direct(mid_t mod_id, flexran_agent_app_t *app, char *name) {
app->start(mod_id, NULL, 0);
flexran_agent_app_internal_t *so = malloc(sizeof(flexran_agent_app_internal_t));
DevAssert(so);
so->name = strdup(name);
DevAssert(so->name);
so->dl_handle = NULL;
so->app = app;
SLIST_INSERT_HEAD(&flexran_apps[mod_id], so, entries);
return 0;
}
int flexran_agent_start_app(mid_t mod_id, Protocol__FlexAgentReconfigurationSubsystem *sub) {
char s[512];
int rc = flexran_agent_map_name_to_delegated_object(mod_id, sub->name, s, 512);
if (rc < 0) {
LOG_E(FLEXRAN_AGENT, "cannot map name %s\n", sub->name);
return -1;
}
void *h = dlopen(s, RTLD_NOW);
if (!h) {
LOG_E(FLEXRAN_AGENT, "cannot open shared object %s\n", s);
return -1;
}
flexran_agent_app_t *app = dlsym(h, "app");
if (!app) {
LOG_E(FLEXRAN_AGENT, "cannot locate app inside of shared object %s\n", s);
return -1;
}
app->start(mod_id, sub->params, sub->n_params);
flexran_agent_app_internal_t *so = malloc(sizeof(flexran_agent_app_internal_t));
DevAssert(so);
so->name = strdup(sub->name);
DevAssert(so->name);
so->dl_handle = h;
so->app = app;
SLIST_INSERT_HEAD(&flexran_apps[mod_id], so, entries);
return 0;
}
int flexran_agent_stop_app(mid_t mod_id, char *name) {
flexran_agent_app_internal_t *so = NULL;
SLIST_FOREACH(so, &flexran_apps[mod_id], entries) {
if (strcmp(so->name, name) == 0) {
LOG_I(FLEXRAN_AGENT, "application %s seems to be running\n", name);
break;
}
}
if (!so) {
LOG_E(FLEXRAN_AGENT, "no such application %s found\n", name);
return -1;
}
flexran_agent_app_t *app = so->app;
app->stop(mod_id);
SLIST_REMOVE(&flexran_apps[mod_id], so, flexran_agent_app_internal_s, entries);
free(so->name);
if (so->dl_handle)
dlclose(so->dl_handle);
free(so);
so = NULL;
return 0;
}
int flexran_agent_reconfig_app(
mid_t mod_id,
Protocol__FlexAgentReconfigurationSubsystem *sub)
{
flexran_agent_app_internal_t *so = NULL;
SLIST_FOREACH(so, &flexran_apps[mod_id], entries) {
if (strcmp(so->name, sub->name) == 0) {
LOG_I(FLEXRAN_AGENT, "application %s is running\n", sub->name);
break;
}
}
if (!so) {
LOG_E(FLEXRAN_AGENT, "no such application %s found\n", sub->name);
return -1;
}
flexran_agent_app_t *app = so->app;
LOG_I(FLEXRAN_AGENT, "reconfiguring app %s\n", so->name);
app->reconfig(mod_id, sub->params, sub->n_params);
return 0;
}
int flexran_agent_custom_command_app(
mid_t mod_id,
Protocol__FlexAgentReconfigurationSubsystem *sub)
{
flexran_agent_app_internal_t *so = NULL;
SLIST_FOREACH(so, &flexran_apps[mod_id], entries) {
if (strcmp(so->name, sub->name) == 0) {
LOG_I(FLEXRAN_AGENT, "application %s is running\n", sub->name);
break;
}
}
if (!so) {
LOG_E(FLEXRAN_AGENT, "no such application %s found\n", sub->name);
return -1;
}
void (*cmd)(mid_t, Protocol__FlexAgentReconfigurationSubsystem *) = dlsym(so->dl_handle, sub->behavior);
if (!cmd) {
LOG_E(FLEXRAN_AGENT,
"cannot locate command %s inside of app %s\n",
sub->behavior,
so->name);
return -1;
}
LOG_I(FLEXRAN_AGENT,
"calling command %s inside of app %s\n",
sub->behavior,
so->name);
(*cmd)(mod_id, sub);
return 0;
}
void flexran_agent_handle_apps(
mid_t mod_id,
Protocol__FlexAgentReconfigurationSubsystem **subs,
int n_subs) {
for (int i = 0; i < n_subs; ++i) {
Protocol__FlexAgentReconfigurationSubsystem *s = subs[i];
if (strcmp(s->behavior, "start") == 0) {
int rc = flexran_agent_start_app(mod_id, s);
if (rc == 0)
LOG_I(FLEXRAN_AGENT, "application \"%s\" started\n", s->name);
} else if (strcmp(s->behavior, "stop") == 0) {
int rc = flexran_agent_stop_app(mod_id, s->name);
if (rc == 0)
LOG_I(FLEXRAN_AGENT, "application \"%s\" stopped\n", s->name);
} else if (strcmp(s->behavior, "reconfig") == 0) {
flexran_agent_reconfig_app(mod_id, s);
} else {
flexran_agent_custom_command_app(mod_id, s);
}
}
}
void flexran_agent_fill_loaded_apps(mid_t mod_id,
Protocol__FlexEnbConfigReply *reply) {
int n = 0;
flexran_agent_app_internal_t *so = NULL;
SLIST_FOREACH(so, &flexran_apps[mod_id], entries)
++n;
reply->n_loadedapps = n;
reply->loadedapps = calloc(n, sizeof(char *));
if (!reply->loadedapps) {
reply->n_loadedapps = 0;
return;
}
n = 0;
SLIST_FOREACH(so, &flexran_apps[mod_id], entries)
reply->loadedapps[n++] = so->name;
}
+74
View File
@@ -0,0 +1,74 @@
/*
* 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
*/
/*! \file flexran_agent_app.h
* \brief Common app definitions
* \author Robert Schmidt
* \date 2020
* \version 0.1
*/
#ifndef BURST_ANALYSIS_LL_H_
#define BURST_ANALYSIS_LL_H_
#include "flexran_agent_common.h"
#include "flexran_agent_async.h"
#include "flexran_agent_extern.h"
#include "flexran_agent_timer.h"
#include "flexran_agent_defs.h"
#include "flexran_agent_net_comm.h"
#include "flexran_agent_ran_api.h"
#include "flexran_agent_phy.h"
#include "flexran_agent_mac.h"
#include "flexran_agent_rrc.h"
#include "flexran_agent_pdcp.h"
#include "flexran_agent_s1ap.h"
#include "common/utils/LOG/log.h"
#include "assertions.h"
/* App type: to be implemented by shared libraries */
typedef struct {
int (*start)(mid_t mod_id,
Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p,
int n_p);
int (*reconfig)(mid_t mod_id,
Protocol__FlexAgentReconfigurationSubsystem__ParamsEntry **p,
int n_p);
int (* stop)(mid_t mod_id);
} flexran_agent_app_t;
/* FlexRAN agent app handling init */
void flexran_agent_app_init(mid_t mod_id);
/* Start an app from within the agent */
int flexran_agent_start_app_direct(mid_t mod_id, flexran_agent_app_t *app, char *name);
/* FlexRAN agent handler to setup/teardown apps */
void flexran_agent_handle_apps(
mid_t mod_id,
Protocol__FlexAgentReconfigurationSubsystem **subs,
int n_subs);
/* Fills the enb_config_reply with the currently loaded (started) apps */
void flexran_agent_fill_loaded_apps(mid_t mod_id,
Protocol__FlexEnbConfigReply *reply);
#endif
+116 -18
View File
@@ -29,6 +29,9 @@
#include <stdio.h>
#include <time.h>
#include <sys/stat.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <errno.h>
#include "flexran_agent_common.h"
#include "flexran_agent_common_internal.h"
@@ -39,6 +42,7 @@
#include "flexran_agent_mac.h"
#include "flexran_agent_rrc.h"
#include "flexran_agent_s1ap.h"
#include "flexran_agent_app.h"
//#include "PHY/extern.h"
#include "common/utils/LOG/log.h"
#include "flexran_agent_mac_internal.h"
@@ -326,6 +330,12 @@ int flexran_agent_destroy_enb_config_reply(Protocol__FlexranMessage *msg) {
if (reply->s1ap)
flexran_agent_free_s1ap_cell_config(&reply->s1ap);
if (reply->loadedapps)
free(reply->loadedapps);
if (reply->loadedmacobjects)
free(reply->loadedmacobjects);
free(reply->cell_config);
free(reply);
free(msg);
@@ -424,26 +434,65 @@ long timer_end(struct timespec start_time) {
int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
Protocol__FlexControlDelegation *control_delegation_msg = input->control_delegation_msg;
// struct timespec vartime = timer_start();
//Write the payload lib into a file in the cache and load the lib
char lib_name[120];
char target[512];
snprintf(lib_name, sizeof(lib_name), "/%s.so", control_delegation_msg->name);
strcpy(target, RC.flexran[mod_id]->cache_name);
strcat(target, lib_name);
FILE *f;
f = fopen(target, "wb");
*msg = NULL;
if (f) {
fwrite(control_delegation_msg->payload.data, control_delegation_msg->payload.len, 1, f);
fclose(f);
char target[512];
int len = snprintf(target, sizeof(target), "%s/libflex.%s.so",
RC.flexran[mod_id]->cache_name,
control_delegation_msg->name);
if (len >= sizeof(target)) {
LOG_E(FLEXRAN_AGENT, "target has been truncated, cannot write file name\n");
return 0;
}
if (control_delegation_msg->has_payload) {
/* use low-level API: check whether exists while creating so we can abort if
* it exists to not overwrite anything */
int fd = open(target, O_CREAT | O_WRONLY | O_EXCL, S_IRUSR | S_IWUSR);
if (fd >= 0) {
ssize_t l = write(fd,
control_delegation_msg->payload.data,
control_delegation_msg->payload.len);
close(fd);
if (l < control_delegation_msg->payload.len) {
LOG_E(FLEXRAN_AGENT,
"could not write complete control delegation to %s: only %ld out of "
"%ld bytes\n",
target,
l,
control_delegation_msg->payload.len);
return 0;
} else if (l < 0) {
LOG_E(FLEXRAN_AGENT, "can not write control delegation data to %s: %s\n",
target, strerror(errno));
return 0;
}
LOG_I(FLEXRAN_AGENT, "wrote shared object %s\n", target);
} else {
if (errno == EEXIST) {
LOG_W(FLEXRAN_AGENT, "file %s already exists, remove it first\n", target);
} else {
LOG_E(FLEXRAN_AGENT, "can not write control delegation data to %s: %s\n",
target, strerror(errno));
}
return 0;
}
} else {
LOG_W(FLEXRAN_AGENT, "[%d] can not write control delegation data to %s\n",
mod_id, target);
LOG_W(FLEXRAN_AGENT, "remove file %s\n", target);
int rc = remove(target);
if (rc < 0)
LOG_E(FLEXRAN_AGENT, "cannot remove file %s: %s\n", target, strerror(errno));
}
if (control_delegation_msg->has_delegation_type
&& control_delegation_msg->delegation_type == PROTOCOL__FLEX_CONTROL_DELEGATION_TYPE__FLCDT_MAC_DL_UE_SCHEDULER
&& control_delegation_msg->header
&& control_delegation_msg->header->has_xid) {
/* Inform the MAC subsystem that a control delegation for it has arrived */
/* TODO this should be triggered by an agent reconfiguration? */
flexran_agent_mac_inform_delegation(mod_id, control_delegation_msg);
}
// long time_elapsed_nanos = timer_end(vartime);
*msg = NULL;
return 0;
}
@@ -452,10 +501,44 @@ int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg) {
return 0;
}
int flexran_agent_map_name_to_delegated_object(mid_t mod_id, const char *name,
char *path, int maxlen) {
int len = snprintf(path, maxlen, "%s/libflex.%s.so",
RC.flexran[mod_id]->cache_name, name);
if (len >= maxlen) {
LOG_E(FLEXRAN_AGENT, "path has been truncated, cannot read object\n");
return -1;
}
struct stat buf;
int status = stat(path, &buf);
if (status < 0) {
LOG_E(FLEXRAN_AGENT, "Could not stat object %s: %s\n", path, strerror(errno));
return -1;
}
return 0;
}
int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
Protocol__FlexranMessage *input = (Protocol__FlexranMessage *)params;
Protocol__FlexAgentReconfiguration *agent_reconfiguration_msg = input->agent_reconfiguration_msg;
apply_reconfiguration_policy(mod_id, agent_reconfiguration_msg->policy, strlen(agent_reconfiguration_msg->policy));
if (agent_reconfiguration_msg->policy) {
/* for compatibility: call old YAML configuration code, although we don't
* use it anymore */
apply_reconfiguration_policy(mod_id,
agent_reconfiguration_msg->policy,
strlen(agent_reconfiguration_msg->policy));
}
for (int i = 0; i < agent_reconfiguration_msg->n_systems; ++i) {
const Protocol__FlexAgentReconfigurationSystem *sys = agent_reconfiguration_msg->systems[i];
if (strcmp(sys->system, "app") == 0) {
flexran_agent_handle_apps(mod_id, sys->subsystems, sys->n_subsystems);
} else {
LOG_E(FLEXRAN_AGENT,
"unknown system name %s in flex_agent_reconfiguration message\n",
sys->system);
}
}
*msg = NULL;
return 0;
}
@@ -465,6 +548,15 @@ int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg) {
return 0;
}
int flexran_agent_destroy_control_delegation_request(Protocol__FlexranMessage *msg) {
if(msg->msg_case != PROTOCOL__FLEXRAN_MESSAGE__MSG_CONTROL_DEL_REQ_MSG)
return -1;
free(msg->control_del_req_msg->header);
free(msg->control_del_req_msg->name);
free(msg);
return 0;
}
int flexran_agent_lc_config_reply(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
xid_t xid;
@@ -750,6 +842,10 @@ int flexran_agent_enb_config_reply(mid_t mod_id, const void *params, Protocol__F
if (flexran_agent_get_s1ap_xface(mod_id))
flexran_agent_fill_s1ap_cell_config(mod_id, &enb_config_reply_msg->s1ap);
flexran_agent_fill_loaded_apps(mod_id, enb_config_reply_msg);
flexran_agent_mac_fill_loaded_mac_objects(mod_id, enb_config_reply_msg);
*msg = malloc(sizeof(Protocol__FlexranMessage));
if(*msg == NULL) {
@@ -880,7 +976,9 @@ int flexran_agent_handle_enb_config_reply(mid_t mod_id, const void *params, Prot
if (enb_config->n_cell_config > 0) {
if (flexran_agent_get_mac_xface(mod_id) && enb_config->cell_config[0]->slice_config) {
prepare_update_slice_config(mod_id, &enb_config->cell_config[0]->slice_config);
prepare_update_slice_config(mod_id,
&enb_config->cell_config[0]->slice_config,
1 /* request objects if necessary */);
}
if (enb_config->cell_config[0]->has_eutra_band
&& enb_config->cell_config[0]->has_dl_freq
+9
View File
@@ -131,11 +131,20 @@ int flexran_agent_destroy_lc_config_request(Protocol__FlexranMessage *msg);
/* Control delegation message constructor and destructor */
int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_control_delegation(Protocol__FlexranMessage *msg);
/* Map a name from a control_delegation message to a file name. The function
* stat()s the file to check existence and returns the complete path name in
* path. The length in path needs to be maxlen, the maximum length the path may
* have. */
int flexran_agent_map_name_to_delegated_object(mid_t mod_id, const char *name,
char *path, int maxlen);
/* Policy reconfiguration message constructor and destructor */
int flexran_agent_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_agent_reconfiguration(Protocol__FlexranMessage *msg);
/* Policy reconfiguration request message destructor */
int flexran_agent_destroy_control_delegation_request(Protocol__FlexranMessage *msg);
/* rrc triggering measurement message constructor and destructor */
int flexran_agent_rrc_reconfiguration(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg);
int flexran_agent_destroy_rrc_reconfiguration(Protocol__FlexranMessage *msg);
+6
View File
@@ -32,6 +32,7 @@
#include "flexran_agent_rrc.h"
#include "flexran_agent_pdcp.h"
#include "flexran_agent_s1ap.h"
#include "flexran_agent_app.h"
#include "flexran_agent_timer.h"
#include "flexran_agent_ran_api.h"
#include "common/utils/LOG/log.h"
@@ -80,6 +81,11 @@ flexran_agent_message_destruction_callback message_destruction_callback[] = {
flexran_agent_destroy_ue_state_change,
flexran_agent_destroy_control_delegation,
flexran_agent_destroy_agent_reconfiguration,
NULL, /* flex_rrc_triggering */
NULL, /* flex_ul_mac_config */
NULL, /* flex_disconnect */
NULL, /* flex_ho_command */
flexran_agent_destroy_control_delegation_request,
};
/* static const char *flexran_agent_direction2String[] = { */
+16 -14
View File
@@ -3092,12 +3092,13 @@ int flexran_get_ue_dl_slice_id(mid_t mod_id, mid_t ue_id) {
return slices->s[idx]->id;
}
void flexran_set_ue_dl_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id) {
if (!mac_is_present(mod_id)) return;
int flexran_set_ue_dl_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id) {
if (!mac_is_present(mod_id)) return 0;
int idx = flexran_find_dl_slice(mod_id, slice_id);
if (idx < 0) return;
if (idx < 0) return 0;
pp_impl_param_t *dl = &RC.mac[mod_id]->pre_processor_dl;
dl->move_UE(dl->slices, ue_id, idx);
return 1;
}
int flexran_get_ue_ul_slice_id(mid_t mod_id, mid_t ue_id) {
@@ -3108,15 +3109,16 @@ int flexran_get_ue_ul_slice_id(mid_t mod_id, mid_t ue_id) {
return slices->s[idx]->id;
}
void flexran_set_ue_ul_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id) {
if (!mac_is_present(mod_id)) return;
int flexran_set_ue_ul_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id) {
if (!mac_is_present(mod_id)) return 0;
int idx = flexran_find_ul_slice(mod_id, slice_id);
if (idx < 0) return;
if (idx < 0) return 0;
pp_impl_param_t *ul = &RC.mac[mod_id]->pre_processor_ul;
ul->move_UE(ul->slices, ue_id, idx);
return 1;
}
int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) {
int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s, void *object) {
if (!mac_is_present(mod_id)) return 0;
void *params = NULL;
switch (s->params_case) {
@@ -3133,7 +3135,7 @@ int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s) {
char *l = s->label ? strdup(s->label) : NULL;
void *algo = &dl->dl_algo; // default scheduler
if (s->scheduler) {
algo = dlsym(NULL, s->scheduler);
algo = dlsym(object, s->scheduler);
if (!algo) {
free(params);
LOG_E(FLEXRAN_AGENT, "cannot locate scheduler '%s'\n", s->scheduler);
@@ -3193,7 +3195,7 @@ int flexran_get_num_dl_slices(mid_t mod_id) {
return RC.mac[mod_id]->pre_processor_dl.slices->num;
}
int flexran_create_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s) {
int flexran_create_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s, void *object) {
if (!mac_is_present(mod_id)) return -1;
void *params = NULL;
switch (s->params_case) {
@@ -3210,7 +3212,7 @@ int flexran_create_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s) {
char *l = s->label ? strdup(s->label) : NULL;
void *algo = &ul->ul_algo; // default scheduler
if (s->scheduler) {
algo = dlsym(NULL, s->scheduler);
algo = dlsym(object, s->scheduler);
if (!algo) {
free(params);
LOG_E(FLEXRAN_AGENT, "cannot locate scheduler '%s'\n", s->scheduler);
@@ -3276,9 +3278,9 @@ char *flexran_get_dl_scheduler_name(mid_t mod_id) {
return RC.mac[mod_id]->pre_processor_dl.dl_algo.name;
}
int flexran_set_dl_scheduler(mid_t mod_id, char *sched) {
int flexran_set_dl_scheduler(mid_t mod_id, char *sched, void *object) {
if (!mac_is_present(mod_id)) return -1;
void *d = dlsym(NULL, sched);
void *d = dlsym(object, sched);
if (!d) return -2;
pp_impl_param_t *dl_pp = &RC.mac[mod_id]->pre_processor_dl;
dl_pp->dl_algo.unset(&dl_pp->dl_algo.data);
@@ -3292,9 +3294,9 @@ char *flexran_get_ul_scheduler_name(mid_t mod_id) {
return RC.mac[mod_id]->pre_processor_ul.ul_algo.name;
}
int flexran_set_ul_scheduler(mid_t mod_id, char *sched) {
int flexran_set_ul_scheduler(mid_t mod_id, char *sched, void *object) {
if (!mac_is_present(mod_id)) return -1;
void *d = dlsym(NULL, sched);
void *d = dlsym(object, sched);
if (!d) return -2;
pp_impl_param_t *ul_pp = &RC.mac[mod_id]->pre_processor_ul;
ul_pp->ul_algo.unset(&ul_pp->ul_algo.data);
+12 -10
View File
@@ -669,15 +669,16 @@ int flexran_set_ul_slice_algo(mid_t mod_id, Protocol__FlexSliceAlgorithm algo);
/* Get the DL slice ID for a UE */
int flexran_get_ue_dl_slice_id(mid_t mod_id, mid_t ue_id);
/* Set the DL slice for a UE */
void flexran_set_ue_dl_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id);
int flexran_set_ue_dl_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id);
/* Get the UL slice ID for a UE */
int flexran_get_ue_ul_slice_id(mid_t mod_id, mid_t ue_id);
/* Set the UL slice for a UE */
void flexran_set_ue_ul_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id);
int flexran_set_ue_ul_slice_id(mid_t mod_id, mid_t ue_id, slice_id_t slice_id);
/* Create slice in DL, returns the new slice index */
int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s);
/* Create slice in DL, returns the new slice index, object can be shared
* library for the scheduler or NULL */
int flexran_create_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s, void *object);
/* Remove slice in DL, returns new number of slices or -1 on error */
int flexran_remove_dl_slice(mid_t mod_id, const Protocol__FlexSlice *s);
@@ -691,8 +692,9 @@ void flexran_get_dl_slice(mid_t mod_id,
/* Get the number of slices in DL */
int flexran_get_num_dl_slices(mid_t mod_id);
/* Create slice in UL, returns the new slice index */
int flexran_create_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s);
/* Create slice in UL, returns the new slice index, object can be shared library
* for the scheduler or NULL */
int flexran_create_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s, void *object);
/* Remove slice in UL */
int flexran_remove_ul_slice(mid_t mod_id, const Protocol__FlexSlice *s);
@@ -708,14 +710,14 @@ int flexran_get_num_ul_slices(mid_t mod_id);
/* Get the name of/Set the DL scheduling algorithm. If slicing is active, this
* corresponds to the default algorithm for slices, otherwise the currently
* used one. */
* used one. object is a shared object in which to find the scheduler */
char *flexran_get_dl_scheduler_name(mid_t mod_id);
int flexran_set_dl_scheduler(mid_t mod_id, char *sched);
int flexran_set_dl_scheduler(mid_t mod_id, char *sched, void *object);
/* Get the name of/Set the UL scheduler algorithm. Same applies as for the DL
* case */
* case. object is a shared object in which to find the scheduler */
char *flexran_get_ul_scheduler_name(mid_t mod_id);
int flexran_set_ul_scheduler(mid_t mod_id, char *sched);
int flexran_set_ul_scheduler(mid_t mod_id, char *sched, void *object);
/************************** S1AP **************************/
/* Get the number of MMEs to be connected */

Some files were not shown because too many files have changed in this diff Show More